Craft Themes (4.x)

Templates
in package

Helper related to themes templating

Tags
since
4.2.0

Table of Contents

getAvailableProTemplates()  : array<string|int, mixed>
getOverriddenForTheme()  : array<string|int, mixed>
Get all the templates that a theme overriddes
getThemeTemplates()  : array<string|int, mixed>
Get all possible templates for a theme
isTemplateOverridden()  : ThemeInterface|null
Is a template overridden by a theme.
checkBaseTemplates()  : mixed
For an array of base templates, check if a theme overrides them, add it to &$templates if so.
getBlocksBaseTemplates()  : array<string|int, mixed>
Get all possible block templates
getFieldBaseTemplates()  : array<string|int, mixed>
Get all possible templates for a field displayer
getFieldDisplayersBaseTemplates()  : array<string|int, mixed>
Get all possible field templates
getFileBaseTemplates()  : array<string|int, mixed>
Get all possible templates for a file displayer
getFileDisplayersBaseTemplates()  : array<string|int, mixed>
Get all possible file templates
getGroupsBaseTemplates()  : array<string|int, mixed>
Get all possible group templates
getLayoutsBaseTemplates()  : array<string|int, mixed>
Get all possible layout templates
getRegionsBaseTemplates()  : array<string|int, mixed>
Get all possible region templates
sortTemplates()  : mixed
Sort an array of templates by name ascendant

Methods

getAvailableProTemplates()

public static getAvailableProTemplates(ThemeInterface $theme) : array<string|int, mixed>
Parameters
$theme : ThemeInterface
Return values
array<string|int, mixed>

getOverriddenForTheme()

Get all the templates that a theme overriddes

public static getOverriddenForTheme(ThemeInterface $theme) : array<string|int, mixed>
Parameters
$theme : ThemeInterface
Return values
array<string|int, mixed>

getThemeTemplates()

Get all possible templates for a theme

public static getThemeTemplates(ThemeInterface $theme) : array<string|int, mixed>
Parameters
$theme : ThemeInterface
Return values
array<string|int, mixed>

isTemplateOverridden()

Is a template overridden by a theme.

public static isTemplateOverridden(string $template, ThemeInterface $theme) : ThemeInterface|null

Returns the theme that overriddes it (it could be a parent theme), or null

Parameters
$template : string
$theme : ThemeInterface
Return values
ThemeInterface|null

checkBaseTemplates()

For an array of base templates, check if a theme overrides them, add it to &$templates if so.

protected static checkBaseTemplates(array<string|int, mixed> &$templates, array<string|int, mixed> $baseTemplates, ThemeInterface $theme[, ThemeInterface|null $themeFrom = null ]) : mixed

If a $themeFrom is given and the template is overridden in that $themeFrom it will not add it to the array.

Parameters
$templates : array<string|int, mixed>
$baseTemplates : array<string|int, mixed>
$theme : ThemeInterface
$themeFrom : ThemeInterface|null = null
Return values
mixed

getBlocksBaseTemplates()

Get all possible block templates

protected static getBlocksBaseTemplates(ThemeInterface $theme) : array<string|int, mixed>
Parameters
$theme : ThemeInterface
Return values
array<string|int, mixed>

getFieldDisplayersBaseTemplates()

Get all possible field templates

protected static getFieldDisplayersBaseTemplates(ThemeInterface $theme) : array<string|int, mixed>
Parameters
$theme : ThemeInterface
Return values
array<string|int, mixed>

getFileDisplayersBaseTemplates()

Get all possible file templates

protected static getFileDisplayersBaseTemplates(ThemeInterface $theme) : array<string|int, mixed>
Parameters
$theme : ThemeInterface
Return values
array<string|int, mixed>

getGroupsBaseTemplates()

Get all possible group templates

protected static getGroupsBaseTemplates(ThemeInterface $theme) : array<string|int, mixed>
Parameters
$theme : ThemeInterface
Return values
array<string|int, mixed>

getLayoutsBaseTemplates()

Get all possible layout templates

protected static getLayoutsBaseTemplates(ThemeInterface $theme) : array<string|int, mixed>
Parameters
$theme : ThemeInterface
Return values
array<string|int, mixed>

getRegionsBaseTemplates()

Get all possible region templates

protected static getRegionsBaseTemplates(ThemeInterface $theme) : array<string|int, mixed>
Parameters
$theme : ThemeInterface
Return values
array<string|int, mixed>

sortTemplates()

Sort an array of templates by name ascendant

protected static sortTemplates(array<string|int, mixed> &$array) : mixed
Parameters
$array : array<string|int, mixed>
Return values
mixed

Search results