API / Minn\Blocks\Dynamic\Theme / TermBlocks

TermBlocks final readonly class

Minn\Blocks\Dynamic\Theme\TermBlocks · public/minn/src/Minn/Blocks/Dynamic/Theme/TermBlocks.php · 71 lines

term-name, term-count and term-description: the term a block's context names (termId and taxonomy, as a terms query provides them), else the term archive being viewed; nothing for neither (probe core-blocks).

Constants and properties

privateBRACKETS = array ( 'round' => array ( 0 => '(', 1 => ')', ), 'square' => array ( 0 => '[', 1 => ']', ), 'curly' => array ( 0 => '{', 1 => '}', ), 'angle' => array ( 0 => '<', 1 => '>', ), 'none' => array ( 0 => '', 1 => '', ), )
privatereadonly Minn\Content\Terms $terms

Promoted from the constructor.

privatereadonly Minn\Front\Permalinks $permalinks

Promoted from the constructor.

Public

new__construct(Minn\Content\Terms $terms, Minn\Front\Permalinks $permalinks)#
methodregister(Minn\Blocks\Renderer $renderer): void#

Registers this family's blocks with the renderer.

Internals 4

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatename(Minn\Blocks\Block $block, Minn\Blocks\Renderer $renderer): string#

The name, as a paragraph or the heading level asked for, linked to its archive when asked.

privatecount(Minn\Blocks\Block $block, Minn\Blocks\Renderer $renderer): string#

How many posts the term holds, in the brackets asked for (round by default).

privatedescription(Minn\Blocks\Block $block, Minn\Blocks\Renderer $renderer): string#

The description as written for a term in context; a term archive's as a paragraph, the way term_description gives it.

privateterm(Minn\Blocks\Renderer $renderer): array#
@return array{?TermRecord, bool} the term, and whether the block's context named it