Forums / Extensions / eZ Flow / Solution for avoid all block in adding list of zone layout

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Solution for avoid all block in adding list of zone layout

Author Message

Bin LIU

Friday 18 April 2008 2:34:52 am

In a zone, by defaut, it allow create all the block type.
For avoid it, change the template page/zone.tpl.
line 11 :

{foreach ezini( 'General', 'AllowedTypes', 'block.ini' ) as $type}

By

{foreach ezini( concat($attribute.content.zone_layout,'_zone',$zone_id) , 'AllowedTypes', 'block.ini' ) as $type}

And define the list block allowed by zone de layout in block.ini.

like this

#block.ini.

[HomeTOTO_zone1]

AllowedTypes[]=block1

AllowedTypes[]=block2

[HomeTITI_zone2]

AllowedTypes[]=block3

=== Lagardère Active ===

Fetch random
http://projects.ez.no/la_fetch_random
LA Static Cache
http://projects.ez.no/lastaticcache
LA Bookmarks (jquery)
http://projects.ez.no/labookmark
LA Calendar (jquery)
http://projects.ez.no/lacalendar

My site ez
http://lingping.info

Sebastian Schoeller

Wednesday 10 February 2010 12:54:33 am

Hi Bin Liu,

thanks for the very useful hack. I altered it so that blocks are en-/disabled per layout.

{foreach ezini( $attribute.content.zone_layout , 'AllowedBlocks', 'zone.ini' ) as $type}

Afterwards the zone.ini needs to be extended as follows

[GlobalZoneLayout]
ZoneTypeName=Global zone layout
Zones[]=main
ZoneName[main]=Global zone
ZoneThumbnail=globalzone_layout.gif
Template=globalzonelayout.tpl
AvailableForClasses[]=global_layout
AllowedBlocks[]=DemoBlock
AllowedBlocks[]=Manual2Items
AllowedBlocks[]=Manual3Items
AllowedBlocks[]=Manual4Items
AllowedBlocks[]=Manual5Items
AllowedBlocks[]=Dynamic3Items

Works and does the job, although your hack is more fine grained. Thanks for the hint and best wishes

Sebastian

Stefan Eickhoff

Wednesday 26 January 2011 1:20:50 am

Hi Bin Liu,

very usefull tip, thank you.

I use it that way

- use zone_identifier string
- use [General]-Block as default

{def $allowedBlocks = cond(ezini( concat($attribute.content.zone_layout,'_', $zone.zone_identifier) , 'AllowedTypes', 'block.ini' )|count(), ezini( concat($attribute.content.zone_layout,'_', $zone.zone_identifier) , 'AllowedTypes', 'block.ini' ), ezini( 'General', 'AllowedTypes', 'block.ini' ))} 

{foreach $allowedBlocks as $type}
 <option value="{$type}">{ezini( $type, 'Name', 'block.ini' )}</option>
 {/foreach}
#block.ini

[MyLayout_left]
AllowedTypes[]=news
AllowedTypes[]=content

[MyLayout_right]
AllowedTypes[]=teaser

lg

Stefan