API / Minn\Blocks\Dynamic\Theme / NavigationParts

NavigationParts final class

Minn\Blocks\Dynamic\Theme\NavigationParts · public/minn/src/Minn/Blocks/Dynamic/Theme/NavigationParts.php · 197 lines

The navigation family's small answers for the block_core_navigation_* helpers (probes navigation-blocks, nav-pomo-rest-doubts): colour classes and inline styles from a block's attributes or context, the post ids its links point to, whether an item renders, and the typography presets older content stored.

Public

staticcolors(array $text, array $background): array#

Colour classes and inline styles: for the text and for the background, the first candidate set (a [kind, value] pair, kind named or custom) wins: has-text-color and the named colour's class, or the custom one inline; the same for the background.

$textlist<array{0: string, 1: mixed}>
$backgroundlist<array{0: string, 1: mixed}>
@return array{css_classes: list<string>, inline_styles: string}
staticnamedFirst(mixed $source, string $prefix = ''): array#

A source's colours with the named one first, the custom one next and, when a style key is given, the style's colour last.

@return array{css_classes: list<string>, inline_styles: string}
staticnavigationColors(mixed $attributes): array#

A navigation's colours and its overlay's, from its attributes (no style colours).

@return array<string, mixed>
staticpageListColors(mixed $context): array#

A page list's colours, the style's own last, and its overlay's, from its navigation's context.

@return array<string, mixed>
staticlinkColors(mixed $context): array#

A link's colours from its navigation's context: the custom colour first, then the named one, then the style's.

@return array{css_classes: list<string>, inline_styles: string}
staticsubmenuLinkColors(mixed $context): array#

A link's colours inside a submenu: the overlay's custom then named colour first, else the link's own.

@return array{css_classes: list<string>, inline_styles: string}
staticpostIds(mixed $blocks): array#

The post ids the links in blocks point to, at any depth (a block's inner links before its own), each once at its first key.

@return array<int, mixed>
staticblockPostIds(mixed $block): array#

The post ids a block's inner links point to, then its own when it links to a post.

@return list<mixed>
staticitemRenders(mixed $attributes, mixed $block): bool#

Whether a navigation item renders: a link to a post or a page (by its kind or its type) only while that post's status is one render_block_core_navigation_link_allowed_post_status allows (publish).

statictypographyBackcompat(mixed $parsedBlock): mixed#

A navigation's typography presets in the forms older content stored (var:preset|...) read as their values, strikethrough as line-through.

Internals 2

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

privatelinkCandidates(array $context): array#

A link's text and background candidates: custom, named, the style's.

$contextarray<string, mixed>
@return array{0: list<array{0: string, 1: mixed}>, 1: list<array{0: string, 1: mixed}>}
privateoverlay(array $source): array#

The overlay colours alongside the main ones, from a source's overlay* keys.

$sourcearray<string, mixed>
@return array{overlay_css_classes: list<string>, overlay_inline_styles: string}