TemplateHierarchy final class
Minn\Theme\TemplateHierarchy · public/minn/src/Minn/Theme/TemplateHierarchy.php · 75 lines
The templates a block theme falls back through for a template slug, as get_template_hierarchy builds them (probe rest-templates-lookup): the slug itself, then its family's chain to index. A single entry's slug reaches single-{type} and single only when the type is registered (and goes straight to singular when not); a taxonomy's reaches taxonomy-{tax} and taxonomy only when the taxonomy is; pages, categories, tags and authors step through their bare name when the slug has more to it. A prefix names the next step outright. A custom template is a page's.
Public
| static | for(string $slug, bool $custom, string $prefix, array $types, array $taxonomies): array# | A slug's fallback chain, most specific first, ending at index.
@return list<string> |
Internals 4
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | chain(string $slug, array $types, array $taxonomies): array# | What follows a slug (or a prefix) down to index.
@return list<string> | ||||||
| private | single(string $rest, array $types): array# |
| ||||||
| private | taxonomy(string $rest, array $taxonomies): array# |
| ||||||
| private | registered(string $rest, array $names): ?string# | The registered name a slug's remainder starts with (the whole of it, or before a hyphen), the longest first. @param list<string> $names
|
Nothing matches.