Print_Toc
extends Printing
in package
Print table of contents.
Tags
Table of Contents
Constants
- CHAPTER_CONTAINER = 'print-toc-chapter.php'
- TOC chapter container filename.
- DEFAULT_PRINT_ARGS = array('content' => 'post', 'from' => '', 'to' => '', 'updated' => false, 'tid' => 0, 'num_posts' => -1, 'order' => 'ASC', 'order_by' => 'name', 'post_ids' => array(), 'recipe_ids' => array(), 'include_recipes' => false, 'post_type' => array('post', 'pfic_ingredient'), 'recipes_only' => false, 'url' => '')
- Default arguments for printing.
- ENTRY_CONTAINER = 'print-toc-entry.php'
- TOC line item partial filename.
- FEATURED_IMAGE_SIZE = 'large'
- Featured image size.
- ITEM_CONTAINER = 'print-toc.php'
- TOC container filename.
- WPRM_START_STRING = '<!-- wp:wp-recipe-maker/recipe '
- Start of WPRM content in post content.
Properties
- $chapter : Chapter
- The instance of the Chapter class.
- $chapter_container_path : string
- The fully qualified path to the toc chapter partial.
- $entry_container_path : string
- The fully qualified path to the toc entry partial.
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
- $item_container : string
- The fully qualified path to the print item content partial.
- $media : Media
- The instance of the pNet media class.
- $partials_dir : string
- The path to the partials directory.
- $posts : Posts
- The instance of the Posts class.
Methods
- get_chapter_entries() : string
- Return the table of contents entries for a chapter.
- get_instance() : object
- Creates and/or returns the instance of this class.
- render() : void
- Render the table of contents.
- render_item() : void
- Render a single item.
- __construct() : void
- Initialise the class and set its properties.
- get_featured_image_url() : string
- Return the featured image details.
Constants
CHAPTER_CONTAINER
TOC chapter container filename.
protected
mixed
CHAPTER_CONTAINER
= 'print-toc-chapter.php'
Tags
DEFAULT_PRINT_ARGS
Default arguments for printing.
protected
array<string|int, mixed>
DEFAULT_PRINT_ARGS
= array('content' => 'post', 'from' => '', 'to' => '', 'updated' => false, 'tid' => 0, 'num_posts' => -1, 'order' => 'ASC', 'order_by' => 'name', 'post_ids' => array(), 'recipe_ids' => array(), 'include_recipes' => false, 'post_type' => array('post', 'pfic_ingredient'), 'recipes_only' => false, 'url' => '')
{ The default arguments to determine print content. @type string $content The type of content to display. Required - will default to post if not specified. @type string $from The inclusive start date for date range. @type string $to The inclusive end date for date range. @type bool $updated Use published date (false) or updated date (true). Defaults to false. @type int|string $tid The term id of the chapter to print, or 'all' to include all chapters. @type int $num_posts The number of posts to return.. @type string $order The posts sort order. @type string $orderby The posts sort key. @type int[] $post_ids The array of post_ids to print. @type int[] $recipe_ids The array of recipe ids to print. @type bool $include_recipes Flag to indicate if recipes hould be included in menu output. @type string[] $post_type The array of post types to include in query. @type bool $recipes-only Flag to indicate if only recipes should be included in the print output. @type string $url The URL of the relevant post or page. Used to build the QR code. }
Tags
ENTRY_CONTAINER
TOC line item partial filename.
protected
mixed
ENTRY_CONTAINER
= 'print-toc-entry.php'
Tags
FEATURED_IMAGE_SIZE
Featured image size.
protected
string
FEATURED_IMAGE_SIZE
= 'large'
The size of the featured image.
Tags
ITEM_CONTAINER
TOC container filename.
protected
string
ITEM_CONTAINER
= 'print-toc.php'
Tags
WPRM_START_STRING
Start of WPRM content in post content.
protected
string
WPRM_START_STRING
= '<!-- wp:wp-recipe-maker/recipe '
- The trailing space is important to avoid detecting other WPRM content.
Tags
Properties
$chapter
The instance of the Chapter class.
protected
Chapter
$chapter
Tags
$chapter_container_path
The fully qualified path to the toc chapter partial.
protected
string
$chapter_container_path
Tags
$entry_container_path
The fully qualified path to the toc entry partial.
protected
string
$entry_container_path
Tags
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
$item_container
The fully qualified path to the print item content partial.
protected
string
$item_container
Tags
$media
The instance of the pNet media class.
protected
Media
$media
Tags
$partials_dir
The path to the partials directory.
protected
string
$partials_dir
Tags
$posts
The instance of the Posts class.
protected
Posts
$posts
Tags
Methods
get_chapter_entries()
Return the table of contents entries for a chapter.
public
get_chapter_entries(array<string|int, mixed> $args) : string
Parameters
- $args : array<string|int, mixed>
-
The chapter post selection criteria.
Tags
Return values
string —The TOC list entries markup.
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
render()
Render the table of contents.
public
render([array<string|int, mixed> $args = array() ]) : void
Parameters
- $args : array<string|int, mixed> = array()
-
The arguments to determine print content.
Tags
render_item()
Render a single item.
public
render_item(int $post_id, array<string|int, mixed> $args) : void
- MUST override this in child classes.
Parameters
- $post_id : int
-
The ID of the post to use.
- $args : array<string|int, mixed>
-
The arguments to determine print content.
Tags
__construct()
Initialise the class and set its properties.
protected
__construct() : void
Tags
get_featured_image_url()
Return the featured image details.
protected
get_featured_image_url(int $post_id) : string
Parameters
- $post_id : int
-
The ID of the post to use.