eZ Webin ezpagedata template operator
Background
In the early releases of the eZ Website Interface extension (eZ Webin), the pagelayout.tpl file was packed with calculations on which blocks to include where etc. This made quite a messy and suboptimal pagelayout.tpl.
To rectify this, eZ Systems moved a lot of this logic into a new general purpose template operator. This operator combines parameters from the view template, the ini system and the Template Look object, and returns an array of information the pagelayout.tpl template can use.
Unfortunately, they forgot to document it...
eZ Webin template operators
List of template operators included in eZ Webin:
- ezpagedata( array $params ) - returns general page parameters to be used in pagelayout.tpl
- ezpagedata_set( string $key, mixed $value ) - set persistent value for pagelayout, to be used in view templates
- ezpagedata_append( string $key, mixed $value ) - append persistent value to array for pagelayout, to be used in view templates
The persistent_variable is originally only supported in the content view full module/view (the rationale is that the view cache takes effect only here). These template operators extends the support to other modules/views as well.
ezpagedata() template operator
Note: The parameter $params of this operator is an array that is merged with persistent_variable to produce the resulting hash. So if needed you can influence the results directly from pagelayout.tpl.
The return value is a hash that may currently contain the following elements:
- persistent_variable - standard persistent variable from $module_result.content_info.persistent_variable
- show_path - indicates if path should be shown
- website_toolbar - indicates if website toolbar should be shown
- node_id - specifies current node id
- is_edit - indicates if we are in edit mode
- page_root_depth - specifies the depth of the root node
- page_depth - specifies the depth of the current node
- root_node - specifies the node id of the root node
- template_look - the template look content object
- class_identifier - specifies the class identifier of the current node, same as $module_result.content_info.class_identifer
- top_menu - template name for the top menu
- left_menu - template name for the left menu
- current_menu - identifier of the current menu
- extra_menu - indicates whether extra column (right column) should be shown
- extra_menu_node_id - indicates node id of node to use in extra column, default is current node
- extra_menu_subitems - indicates number of sub items in extra column
- extra_menu_class_list - list of classes to be used in extra column
- path_array - list of nodes to be used in path
- path_id_array - list of node ids to be used in path
- path_normalized - normalized string of path identifiers
- css_classes - string of CSS classes to be set in the <div id="page"> tag
Disclaimer: Note that there may be differences between different versions of eZ Webin. This list is based on an eZ Webin v.1.7 codebase.
Values of hash elements
The criterias for the values of the different pagedata() hash elements can be quite complex. The following is a partial list of the elements and the order in which the different values are set for each element. In this illustration line 1 is default value, line 2 takes precedence over line 1 if specified, etc.
Template look
pagedata.template_look
- $persistent_variable['template_look']
- Fetch first object of class identifier specified in $persistent_variable['template_look_class'] (by default it is the string 'template_look')
Current menu
pagedata.current_menu
- menu.ini [SelectedMenu] CurrentMenu=<menu_name>
Top menu
pagedata.top_menu
- menu.ini [SelectedMenu] TopMenu=<template_name>
- $persistent_variable['top_menu']
Left column/menu
pagedata.left_menu
- menu.ini [SelectedMenu] LeftMenu=<template_name>
- $persistent_variable['left_menu']
- $hideMenuClasses != false
- menu.ini [MenuSettings] AlwaysAvailable == false && (.is_edit || 'content/versionview' || current_node_id == false || uicontext 'browse')
Note: .left_menu specify if .css_classes contains 'sidemenu' or 'nosidemenu'
Extra column/menu
pagedata.extra_menu
- 'extra_info'
- $persistent_variable['extra_menu']
- $hideMenuClasses != false
pagedata.extra_menu_node_id
- current_node_id
- $persistent_variable['extra_menu_node_id']
pagedata.extra_menu_class_list
- array( 'infobox' )
- $persistent_variable['extra_menu_class_list']
- menu.ini [MenuContentSettings] ExtraIdentifierList=<class_identifier_list>
pagedata.extra_menu_subitems
- 0
- $persistent_variable['extra_menu_subitems']
- Count of number of sub items in top level of content tree, based on .extra_menu_node_id and .extra_menu_class_list?
Note: If .extra_menu_subitems is false, .extra_menu will also be set to false.
Note: .extra_menu specify if .css_classes contains 'extrainfo' or 'noextrainfo'