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
| private | SCREENSHOTS = array ( 0 => 'png', 1 => 'gif', 2 => 'jpg', 3 => 'jpeg', 4 => 'webp', 5 => 'avif', ) | |
| prop | readonly string $root | Promoted from the constructor. |
| prop | readonly string $slug | Promoted from the constructor. |
| prop | readonly bool $exists | Promoted from the constructor. |
| prop | readonly array $headers | Promoted from the constructor. |
| prop | readonly string $template | Promoted from the constructor. |
Public
| new | __construct(string $root, string $slug, bool $exists, array $headers, string $template)# |
| ||||||
| static | read(string $root, string $slug, array $labels, ?Closure $reader = NULL): self# | A theme folder with its style.css headers.
| ||||||
| method | problem(): ?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 | ||||||
| method | dir(): string# | The folder's path. | ||||||
| method | screenshot(): ?string# | The screenshot file name, or null when the theme has none. | ||||||
| static | isBlockTheme(array $dirs): bool# | Whether any of the folders ships a block template index.
| ||||||
| static | filePath(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. |
Nothing matches.