Feature: Backend layouts decide the page template
Description
The theme ships five backend layouts, and the layout selected on a page now decides which template renders it. Until now every page rendered the same file.
| Layout | Template | Content areas |
|---|---|---|
| Default | Page/ | main |
| Content page | Page/ | stage, main, four footer columns, footermeta |
| Content page with sidebar | Page/ | the same, plus sidebar beside main |
| Start page | Page/ | the same as Content page |
| Styleguide | Page/ | none - it renders components directly |
The column numbers are the ones typo3/theme-camino uses, so content is portable between the two themes.
Registration
The layouts are page TSconfig, in Configuration/, which
TYPO3 auto-loads from every package since v12.0 (forge#96614). No
registration call and no database record is involved, and it applies whether the
theme is delivered through its site set or through the classic
sys_ static include - the alternatives would each only work for
one of those.
Overriding one layout means overriding one file:
mod.web_layout.BackendLayouts.content.config.backend_layout.rows.2.columns.1.colPos = 5
Content areas
Each column is its own TypoScript object, so a site package can replace one without touching the rest:
<f:cObject typoscriptObjectPath="lib.content.main" />
The four footer columns and the footer meta row carry slide = -.
Footer content is therefore edited once on the site root and inherited by
every page below it - what
typo3/theme-camino
gets from
slide, without depending on
typo3/cms-fluid-styled-content
.
Impact
Note
FLUIDTEMPLATE is used rather than PAGEVIEW,
deliberately. PAGEVIEW exists since v13.1
(forge#103504), but the content area layer it is normally used with -
Content and <f: - arrived in
v14.2 (forge#104974) and does not exist on v13.4 at all, so templates
written against it do not compile there. FLUIDTEMPLATE is not
deprecated on either version; the v14.2 changelog calls
PAGEVIEW "a powerful alternative", explicitly not a
replacement.
The template is resolved with data = pagelayout, not
field = backend_. The getter resolves through
Page, which falls back to the first ancestor's
backend_ when a page carries no layout of its own.
Reading the field directly would ignore that, and every sub-page of a configured
parent would silently render the wrong template.
Two edges of that inheritance are worth knowing, and both are covered by
Tests/:
- A page's own
backend_applies to its children and never to itself - the resolver removes the current page from the rootline before searching.layout_ next_ level - Choosing TYPO3's built-in [None] option in the page properties
resolves to the literal identifier
none, which is not empty. It is mapped back todefault; without that it would ask for aPage/that no theme ships and end the request in an exception.None. html
Every column declares an identifier as well as a
name and a col. TYPO3 v14 raises a deprecation
for a column without one and will throw in v15; v13 ignores it, so one spelling
serves both versions.
Note
.theme- carries a data- attribute
naming the layout the page resolved to. Which template rendered a page -
and in particular whether it was inherited - is otherwise invisible in the
frontend, and inheritance is exactly the part that goes wrong quietly.
Only Page/ renders the page title itself. It has no
stage slot, so nothing editorial is guaranteed to carry a heading and an
empty page would render nothing at all. The layouts that do have a stage
leave the heading to the content placed in it, so that those pages do not
end up with two first-level headings.