CoolCMS API

ThemeInitTrait uses trait:short

Table of Contents

Constants

FALLBACK_LAYOUT  : mixed = '@layout_one.latte'
Layout used when the theme lacks the requested one.

Properties

$deviceDetector  : DeviceDetector
$themeContext  : ThemeContext
$themeManager  : ThemeManager
$themeResolver  : DefaultThemeResolver
$theme  : Theme|null

Methods

formatLayoutTemplateFiles()  : array<string|int, mixed>
Returns candidate layout files; Nette takes the first existing one.
formatTemplateFiles()  : array<string|int, mixed>
formatLayoutCandidates()  : array<int, string>
initializeTheme()  : void
layoutFileExists()  : bool

Constants

FALLBACK_LAYOUT

Layout used when the theme lacks the requested one.

private mixed FALLBACK_LAYOUT = '@layout_one.latte'

@layout_one.latte (one column, shared header and footer) exists in every theme and is the plainest page the system can render, so anything fits in it.

IMPORTANT: not @layout.latte; that is a bare Nette skeleton titled "Nette Web" without header, footer or styles, hardly better than a missing layout.

Properties

Methods

formatLayoutTemplateFiles()

Returns candidate layout files; Nette takes the first existing one.

public formatLayoutTemplateFiles() : array<string|int, mixed>

IMPORTANT: when the theme lacks the layout, a fallback is added. The layout name is stored in cms_system_pages.layout, one column shared by all themes, so a page set to @text_layout_two.latte wants that file even in a theme that never got it. Without a fallback Nette finds nothing and renders the presenter without a layout: the page has no header, footer or styles but returns HTTP 200.

The fallback is logged, because a silent fallback would hide the problem entirely; when the page asks for the fallback layout itself and the theme lacks it, there is nowhere to fall back to, so it is logged as an error and the page renders without a layout.

Return values
array<string|int, mixed>

formatTemplateFiles()

public formatTemplateFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>

formatLayoutCandidates()

private formatLayoutCandidates(Theme $theme, string $layout) : array<int, string>
Parameters
$theme : Theme
$layout : string
Return values
array<int, string>

layoutFileExists()

private layoutFileExists(array<int, string> $files) : bool
Parameters
$files : array<int, string>
Return values
bool
On this page

Search results