API / Minn\Theme / Folder

Folder final readonly class

Minn\Theme\Folder · public/minn/src/Minn/Theme/Folder.php · 99 lines

A theme folder read from disk: its style.css headers, which folder its templates come from, its screenshot, whether it is a block theme.

Constants and properties

privateSCREENSHOTS = array ( 0 => 'png', 1 => 'gif', 2 => 'jpg', 3 => 'jpeg', 4 => 'webp', 5 => 'avif', )
propreadonly string $root

Promoted from the constructor.

propreadonly string $slug

Promoted from the constructor.

propreadonly bool $exists

Promoted from the constructor.

propreadonly array $headers

Promoted from the constructor.

propreadonly string $template

Promoted from the constructor.

Public

new__construct(string $root, string $slug, bool $exists, array $headers, string $template)#
$headersarray<string, string>keyed by the caller's labels
staticread(string $root, string $slug, array $labels, ?Closure $reader = NULL): self#

A theme folder with its style.css headers.

$labelsarray<string, string>key => the style.css header label
$readerClosure(string, array<string, string>): array<string, string>|nullthe header reader (the facade's, so header filters apply); the engine's own by default
methodproblem(): ?array#

What keeps the folder from being a whole theme, as the reference names it (probe theme-headers): no folder; no stylesheet; itself named as its parent; a parent that is not there; or, standing alone, no index.php and no templates/index.html. Null for a whole theme.

@return array{0: string, 1: string}|null the error code and message
methoddir(): string#

The folder's path.

methodscreenshot(): ?string#

The screenshot file name, or null when the theme has none.

staticisBlockTheme(array $dirs): bool#

Whether any of the folders ships a block template index.

$dirslist<string>the stylesheet and template directories
staticfilePath(string $stylesheetDir, string $templateDir, string $file): string#

The first of the stylesheet and template directories that holds the file, or the template directory's path.