API / Minn\Theme / PatternHeaders

PatternHeaders final class

Minn\Theme\PatternHeaders · public/minn/src/Minn/Theme/PatternHeaders.php · 78 lines

A theme's pattern files read by their headers, as WP_Theme::get_block_patterns lists them (probe wp-theme). Each one gives title, slug and description (empty when the header has none), then whatever of viewportWidth (a number), inserter (false for "no"), and the lists categories, keywords, blockTypes, postTypes and templateTypes it declares, split on commas and whitespace. A file without a title and a slug is not a pattern.

Constants and properties

privateLISTS = array ( 'categories' => 'Categories', 'keywords' => 'Keywords', 'blockTypes' => 'Block Types', 'postTypes' => 'Post Types', 'templateTypes' => 'Template Types', )

Public

staticall(string $themeDir): array#

The patterns directory's files by file name, in name order.

@return array<string, array<string, mixed>>
staticfiles(string $themeDir): array#

The pattern files a theme ships, file name => path, in name order.

@return array<string, string>
staticof(array $files): array#

The records of a list of pattern files, file name => path (a list a plugin may have changed); a file that is not a pattern is left out.

$filesarray<string, string>
@return array<string, array<string, mixed>>
staticread(string $head): ?array#

One file's record from the start of its text, or null when it names no title or slug.

@return array<string, mixed>|null