Message-ID: <2117009818.2766.1485850737204.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_2765_1757817365.1485850737203" ------=_Part_2765_1757817365.1485850737203 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Creating Landing Page layouts (Enterprise)

Creating Landing Page layouts (Enterprise)

=20
=20
=20
=20

Description

V1.2=

A Landing Page has a customizable layout with multiple zones where you can place pr= edefined blocks with content.

By default eZ Enterprise comes with a number of preset layouts. You can,= however, add custom layouts with zones to your configuration.

Solution

Definin= g the layout

A Landing Page layout is composed of zones.

Zone struct= ure

Each zone contains the following parameters:

Name Description
<zone_id> Required. A unique zone ID
<name> Required. Zone name

Defin= ing a zone layout

You can define a new layout file (e.g. in Twig) for a zone and include i= t in a Landing page layout.

A Zone is a container for blocks. The best way to display blocks in the = zone is to iterate over a blocks array and render the blocks in a loop.

 For eZ Enterprise, the data-studio-zone attribute is = required to allow dropping the Content into specific zones.

Example zone.html.twig
=20
<div data-studio-zone=3D"{{ zones[0].id }}">=09=09=09=09=09=
=09=09=09=09=09
=09{# If a zone with [0] index contains any blocks #}
=09{% if zones[0].blocks %}=09=09=09=09=09=09=09=09=09=09=09=09=09
    =09{# for each block #}
=09=09{% for block in zone[0].blocks %}=09=09=09=09=09=09=09=09=09=09=09=09
    =09=09{# create a new layer with appropriate id #}
=09=09=09<div class=3D"landing-page__block block_{{ block.type }}">=
=09=09=09
       =09=09=09{# render the block by using the "ez_block:renderBlockActio=
n" controller #}
=09=09=09=09{{ render_esi(controller('ez_block:renderBlockAction', {=09=09
           =09=09=09=09{# id of the current content #}
=09=09=09=09=09=09'contentId': contentInfo.id,=09=09=09=09=09=09=09
        =09=09=09=09{# id of the current block #}
=09=09=09=09=09=09'blockId': block.id=09=09=09=09=09=09=09=09=09=09
       =09=09=09=09}))=20
=09=09=09=09}}
    =09=09</div>=09=09
=09=09{% endfor %}=09
=09{% endif %}
</div>
=20

 

Creating and configuring layouts

In the Demo installation the layout configuration is stored in ezstudio-= demo-bundle/Resources/config/default_layouts.yml:

Example default_layouts.yml
=20
layouts:
    1:=09
=09=09identifier: 1=09=09=09=09=09=09
        name: One column
        description: 'One column'
        thumbnail: '/bundles/ezstudiodemo/images/layouts/1.png'
        template: eZStudioDemoBundle:layouts:1.html.twig
        zones:
            first:
                name: First zone

    1_2:
=09=09identifier: 1_2=09
=09=09name: Two zones in columns, narrow left, wide right
        description: Two zones in columns, narrow left, wide right
        thumbnail: '/bundles/ezstudiodemo/images/layouts/1_2.png'
        template: eZStudioDemoBundle:layouts:1_2.html.twig
        zones:
            first:
                name: First zone
            second:
                name: Second zone

    1_2__1:=09 =20
=09=09identifier: 1_2__1
        name: Three zones, two columns, narrow left, wide right in first ro=
w and one row
        description: Three zones, two columns, narrow left, wide right in f=
irst row and one row
        thumbnail: '/bundles/ezstudiodemo/images/layouts/1_2__1.png'
        template: eZStudioDemoBundle:layouts:1_2__1.html.twig
        zones:
            first:
                name: First zone
            second:
                name: Second zone
            third:
                name: Third zone
=20

 

The following parameters need to be included in the settings of the defa= ult_layouts.yml file:

Parameter Type Description Required

layouts

string Layout config root Yes

number

string Unique key of the layout Yes

{ID}/identifier

string ID of the Layout Yes

{ID}/name

string Name of the Layout Yes

{ID}/description

string Description of Layout Yes

{ID}/thumbnail

string <path> to thumbnail image Yes

{ID}/template

string

<path> to template View

For examp= le:
eZStudioDemoBundle:layouts:1.html.twig

<bundl= e>:<directory>:<file name>

Yes

{ID}/zones

=
string

Collection of zones

Yes
{ID}/{zone}/zone_id string ID of the zone Yes
{ID}/{zone}/name<= /td> string Zone name Yes

 

 

=20
=20
=20
=20

In this topi= c:

 

Related to= pics:

Landing Page Field = Type (Enterprise)

Creating Landing Pa= ge blocks (Enterprise)

 

=20
=20
=20
------=_Part_2765_1757817365.1485850737203--