Feature: #90348 - Fluid-based replacement for PageLayoutView
See forge#90348
Description
A completely rewritten replacement for PageLayoutView has been added. This replacement allows third parties to override and extend any part of the "page" module's output by overriding Fluid templates.
Although it is visually identical to the old Page
's output, the new alternative has a number of benefits:
- The grid defined in a BackendLayout is now represented as objects which are assigned to Fluid templates and can be iterated over to render rows, columns and records.
- Custom BackendLayout implementations can now manipulate every part of the configuration that determines how the page module is rendered - or completely replace the logic that draws the "columns" and "languages" views of the page BE module.
- Custom BackendLayout implementations can also provide custom classes for LanguageColumn, Grid, GridRow, GridColumn and GridColumnItem instances that are assigned to and used by Fluid templates to render the page layout.
- Headers, footers and previews for content types can be created in Fluid in a way that groups each of these component templates by the content type (CType) value of content records.
- Any part of the page layout can now be rendered elsewhere by creating instances of any of the "grid" objects and assigning them to Fluid templates.
- The "grid" structure of BackendLayouts can be manipulated as objects, adding and removing rows and columns on-the-fly.
The new Fluid-based implementation is enabled by the global setting $GLOBALS
which can be changed from the install tool or from extensions. The setting is enabled by default, meaning that the Fluid-based implementation is used
as default method in this and future TYPO3 versions.
The feature flag can be managed either by setting it through code (for example, in ext_
of an extension) or you can set it through
the "Settings" admin module's' "Feature Toggles" view.
New Fluid templates:
EXT:
backend/ Resources/ Private/ Templates/ Page Layout/ Page Layout. html EXT:
backend/ Resources/ Private/ Templates/ Page Layout/ Unused Records. html EXT:
backend/ Resources/ Private/ Partials/ Page Layout/ Grid. html EXT:
backend/ Resources/ Private/ Partials/ Page Layout/ Grid/ Column. html EXT:
backend/ Resources/ Private/ Partials/ Page Layout/ Record. html EXT:
backend/ Resources/ Private/ Partials/ Page Layout/ Record/ Header. html EXT:
backend/ Resources/ Private/ Partials/ Page Layout/ Record/ Footer. html
These Fluid templates can be overridden or extended by TS, depending on which type or types of templates you wish to override:
module.
tx_ backend. view. template Root Paths. 100 = EXT: myext/ Resources/ Private/ Templates/ module.
tx_ backend. view. partial Root Paths. 100 = EXT: myext/ Resources/ Private/ Partials/
In addition, custom header/footer/preview templates can be added by extending the partial
and placing for example a template file in:
EXT:
myext/ Resources/ Private/ Partials/ Page Layout/ Record/ my_ contenttype/ Header EXT:
myext/ Resources/ Private/ Partials/ Page Layout/ Record/ my_ contenttype/ Footer EXT:
myext/ Resources/ Private/ Partials/ Page Layout/ Record/ my_ contenttype/ Preview
If no such templates exist the default partials (listed above) are used. Note that the folder name my_
should use the CType value associated with the content type for which you wish to provide a custom header, footer or preview template.
Within these last three types of templates the following variables are available:
{item}
which represents a single record.{backend
which represents theLayout} Backend
instance that defined the grid which was rendered.Layout {grid}
which represents theGrid
instance that was produced by theBackend
(also accessible throughLayout {backend
, provided as extracted variable for easier and more performance-efficient access)Layout. grid}
Properties on {item}
include:
{item.
(the database row of the content element)record} {item.
(thecolumn} Grid
instance within which the item resides)Column {item.
delible} {item.
(bool, whether or not the item is translated)translations} {item.
(bool, whether or not the item can be dragged and dropped)drag And Drop Allowed} {item.
(array)footer Info}
Properties on {backend
include:
{backend
(array, the low level definition of rows/columns within theLayout. configuration Array} Backend
- array form of the pageTSconfig that defines the grid)Layout {backend
Layout. icon Path} {backend
Layout. description} {backend
Layout. identifier} {backend
Layout. title} {backend
(the instance ofLayout. drawing Configuration} Drawing
which holds properties like active language, site languages and TCA labels for content types and content record fields)Configuration {backend
(the instance of theLayout. grid} Grid
that represents the backend layout rows/columns as PHP objects)
Impact
- A new feature setting
$GLOBALS
has been introduced, enabled by default, which allows switching to the legacy['TYPO3_ CONF_ VARS'] ['SYS'] ['features'] ['fluid Based Page Module'] Page
.Layout View - By default, a new set of objects and extended methods on
Backend
now provide a completely Fluid-based implementation of the "page" BE module.Layout