Global navigation

   Documentation Center
   eZ Studio & eZ Platform
     User Manual
     Technical Manual
     Glossary
   eZ Publish 4.x / legacy

 
eZ Publish (5.x)

eZ Publish 5.x | For eZ Platform & eZ Studio topics see Technical manual and User manual, for eZ Publish 4.x and Legacy topics see eZ Publish legacy

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Description

With the Page FieldType, editors define a layout with multiple zones within a single front page.

Within each zone, editors create blocks that contain particular content categories. Specific content can be added to these blocks, they are called block items.

This is particularly useful for managing homepages/landing pages.

The Page FieldType is currently read-only with the Public API.
It's however still possible to edit content with it through the admin interface (which runs through the legacy stack). 

NameInternal nameExpected inputOutput
PageezpageN/AeZ\Publish\Core\FieldType\Page\Parts\Page

Configuration

Defining a zone layout

A layout is a combination of zones that are placed on a page. The placement of the zones is defined in a template that is specified as part of the layout configuration. You can define as many layouts as you need.

You can define a new layout in your main YAML configuration:

ezpublish.yml

Then, when rendering a Page FieldType using myLayoutIdentifier, page/zonelayouts/my_template.html.twig from AcmeDemoBundle will be used.

Warning

You still need to define your available layouts in the legacy part. Please refer to eZ Publish legacy documentation to learn how to do so.

Block template selection

 

Displaying the Page content

Layout template

Goal of a layout template is to display zones for the given layout, depending on your layout configuration.

Variables passed to the layout template

Variable nameDescriptionType
zonesZone objects for this Page fieldArray of eZ\Publish\Core\FieldType\Page\Parts\Zone objects
zone_layoutThe layout identifier (e.g. "2ZonesLayout1")string
pageService

The PageService object (read more below). 

eZ\Bundle\EzPublishCoreBundle\FieldType\Page

Rendering blocks

TODO

Tip

You can use a custom controller to display a block

 

Example

2zoneslayout1.html.twig
campaign_block.html.twig

 

The PageService object

The PageService object (eZ\Bundle\EzPublishCoreBundle\FieldType\Page\PageService) is a helper giving the possibility to get current zone/block definitions and to retrieve block items.

Main methods

Method nameDescriptionReturn type
getZoneDefinition()Returns zone definition (all defined zones for the current siteaccess) as an arrayarray
getZoneDefinitionByLayout()Returns a zone definition for a given layout. It consists of a configuration array for the given layout.array
getBlockDefinition()Returns block definition as an arrayarray
getBlockDefinitionByIdentifier()Returns a block definition for a given block identifier.array
getValidBlockItems()Returns valid items (that are to be displayed), for a given block.eZ\Publish\Core\FieldType\Page\Parts\Item[]
getLastValidBlockItem()Returns the last valid item, for a given block.eZ\Publish\Core\FieldType\Page\Parts\Item|null
getWaitingBlockItems()Returns queued items (the next to be displayed), for a given block.eZ\Publish\Core\FieldType\Page\Parts\Item[]
getArchivedBlockItems()Returns archived items (that were previously displayed), for a given block.eZ\Publish\Core\FieldType\Page\Parts\Item[]
getValidBlockItemsAsContentInfo()Returns valid block items as content objectseZ\Publish\API\Repository\Values\Content\ContentInfo[]

 

 

  • No labels