Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

ezmultioption2 datatype (Multi-option2)

The ezmultioption2 datatype (Multi-option2): what it stores and how templates use it.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/examples/datatypes/ezmultioption2.md

On this page

The ezmultioption2 datatype (Multi-option2)

Class eZMultiOption2Type in kernel/classes/datatypes/ezmultioption2/ezmultioption2type.php; identifier ezmultioption2, listed in settings/content.ini [DataTypeSettings] AvailableDataTypes[].

What it stores

The columns of the attribute tables its class reads or writes: data_text, data_text1 (data_text, data_int, data_float and sort_key_* are the object attribute's; data_text1 ... data_int4 the class attribute's settings). Found by reading the class: a heuristic. It is indexed by the search.

In templates

my_attribute stands for the identifier of an attribute of this type in your class:

{def $attribute = $node.data_map.my_attribute}
{if $attribute.has_content}
    {attribute_view_gui attribute=$attribute}
{/if}
{* the value as the datatype returns it (objectAttributeContent()) *}
{$attribute.content|attribute( show, 1 )}

The shipped template that shows it (attribute_view_gui), design/standard/templates/content/datatype/view/ezmultioption2.tpl (first 25 lines):

{* DO NOT EDIT THIS FILE! Use an override template instead. *}
{default attribute_base=ContentObjectAttribute}
<script type="text/javascript" src={"javascript/ezmultioption/ezmultioption.js"|ezdesign} charset="iso-8859-1"></script>
{* The rules as data for javascript/ezmultioption/ezmultioption_view.js (no inline script, for a Content Security
   Policy without 'unsafe-inline'): a list of [ option_id, [ [ multioption_id, [ option ids for which the option is
   enabled ] ], ... ] ], everything as strings *}
{def $ezmo_rules = array()
     $ezmo_rule = array()
     $ezmo_items = array()}
{foreach $attribute.content.rules as $ezmo_option_id => $ezmo_rule_list}
    {set $ezmo_rule = array()}
    {foreach $ezmo_rule_list as $ezmo_multioption_id => $ezmo_rule_items}
        {set $ezmo_items = array()}
        {foreach $ezmo_rule_items as $ezmo_item}
            {set $ezmo_items = $ezmo_items|append( concat( $ezmo_item, '' ) )}
        {/foreach}
        {set $ezmo_rule = $ezmo_rule|append( array( concat( $ezmo_multioption_id, '' ), $ezmo_items ) )}
    {/foreach}
    {set $ezmo_rules = $ezmo_rules|append( array( concat( $ezmo_option_id, '' ), $ezmo_rule ) )}
{/foreach}
{section var=GroupList loop=$attribute.content.optiongroup_list}
{include uri='design:content/datatype/view/multioption2/multioption2.tpl' name=ChildGroup1 attribute=$attribute group=$GroupList.item parent_group_id=$attribute.content.group_id depth=1}
{/section}
<script type="text/javascript" src={"javascript/ezmultioption/ezmultioption_view.js"|ezdesign} data-attribute-id="{$attribute.id|wash}" data-rules="{json_encode( $ezmo_rules )|wash}"></script>
{undef $ezmo_rules $ezmo_rule $ezmo_items}

The shipped template that edits it (attribute_edit_gui), design/standard/templates/content/datatype/edit/ezmultioption2.tpl:

{* DO NOT EDIT THIS FILE! Use an override template instead. *}
<div class="multioption">
{default attribute_base=ContentObjectAttribute}

{section var=GroupList loop=$attribute.content.optiongroup_list}
{include uri='design:content/datatype/edit/multioption2/multioption2.tpl' name=ChildGroup1 attribute=$attribute group=$GroupList.item parent_group_id=$attribute.content.group_id depth=1}
{/section}

<div class="toolbar">
    <input class="button" type="submit" name="CustomActionButton[{$attribute.id}_new-group]" value="{'Add group'|i18n('design/standard/content/datatype')}" title="{'Add a new group.'|i18n('design/standard/content/datatype')}" />
</div>

<div class="block">
<input class="button" type="submit" name="CustomActionButton[{$attribute.id}_switch-mode_rules]" value="{'Rules'|i18n('design/standard/content/datatype')}" title="{'Set rules'|i18n('design/standard/content/datatype')}" />
<input type="hidden" name = "{$attribute_base}_data_edit_mode_{$attribute.id}" value="options" />
</div>
{/default}
</div>

Override them for one class attribute in an override.ini.append.php with Source=content/datatype/view/ezmultioption2.tpl and a match on attribute_identifier (see A template override).


Generated by ./console exp:help:examples from kernel/classes/datatypes/ezmultioption2/ezmultioption2type.php, settings/content.ini, design/standard/templates/content/datatype/view/ezmultioption2.tpl, design/standard/templates/content/datatype/edit/ezmultioption2.tpl. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x