pfeifferNet

Print_Toc extends Printing
in package

Print table of contents.

Tags
since
5.4.0
since
5.7.0

Inherit Printing class.

uses
Printing

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
since
5.4.0

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
since
5.7.0
since
5.9.0

Add post_type default variable.

since
6.3.0

Add number of posts variable.

ENTRY_CONTAINER

TOC line item partial filename.

protected mixed ENTRY_CONTAINER = 'print-toc-entry.php'
Tags
since
5.4.0

Featured image size.

protected string FEATURED_IMAGE_SIZE = 'large'

The size of the featured image.

Tags
since
5.7.0

ITEM_CONTAINER

TOC container filename.

protected string ITEM_CONTAINER = 'print-toc.php'
Tags
since
5.4.0

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
since
5.4.0

Properties

$chapter_container_path

The fully qualified path to the toc chapter partial.

protected string $chapter_container_path
Tags
since
5.4.0

$entry_container_path

The fully qualified path to the toc entry partial.

protected string $entry_container_path
Tags
since
5.4.0

$instances

The array of instances of this class and sub-classes.

protected static array<string|int, object> $instances = array()
Tags
since
6.0.0

$item_container

The fully qualified path to the print item content partial.

protected string $item_container
Tags
since
5.7.0

$partials_dir

The path to the partials directory.

protected string $partials_dir
Tags
since
5.7.0

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
since
5.12.0
see
Chapter::DEFAULT_CHAPTER_POST_ARGS
uses
Chapter::get_posts()
used-by
Print_Chapter_Intro::render()
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
since
6.0.0
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
since
5.4.0
uses
Chapter::get_chapters()
uses
Chapter::get_posts()
see
Printing::DEFAULT_PRINT_ARGS

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
since
5.7.0
see
Printing::DEFAULT_PRINT_ARGS

__construct()

Initialise the class and set its properties.

protected __construct() : void
Tags
since
5.4.0

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.

Tags
since
5.7.0
uses
Media::get_featured_image_url()
Return values
string

        
On this page

Search results