The ezselection datatype (Selection)
Class eZSelectionType in kernel/classes/datatypes/ezselection/ezselectiontype.php; identifier ezselection, listed in settings/content.ini [DataTypeSettings] AvailableDataTypes[].
What it stores
The columns of the attribute tables its class reads or writes: data_int1, data_text, data_text5 (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.
Sorting: sortKeyType() returns string.
It is indexed by the search; collects information (forms).
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/ezselection.tpl:
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
{* The selected options in the order of the class, one per line: a <br /> only between two of them, nothing
before, after or around a single one (portions derived from LoveStack, mugoweb/ezpublish-legacy, commits
eee7f69fc3 and 67eec8f972, Copyright (C) Mugo Web, GPL v2). *}
{def $selected_id_array = $attribute.content
$selection_shown = false()}
foreach $attribute.class_content.options as $optionif $selected_id_array|contains( $option.id )if $selection_shown<br />/if$option.name|wash( xhtml )set $selection_shown = true()/if/foreach
undef $selected_id_array $selection_shownThe shipped template that edits it (attribute_edit_gui), design/standard/templates/content/datatype/edit/ezselection.tpl:
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
default attribute_base=ContentObjectAttribute
let selected_id_array=$attribute.content
{* Always set the .._selected_array_.. variable, this circumvents the problem when nothing is selected. *}
<input type="hidden" name="$attribute_base_ezselect_selected_array_$attribute.id" value="" />
<select id="ezcoa-if ne( $attribute_base, 'ContentObjectAttribute' )$attribute_base-/if$attribute.contentclassattribute_id_$attribute.contentclass_attribute_identifier" class="ezcc-$attribute.object.content_class.identifier ezcca-$attribute.object.content_class.identifier_$attribute.contentclass_attribute_identifier" name="$attribute_base_ezselect_selected_array_$attribute.id[]" if $attribute.class_content.is_multiselectmultiple/if>
section var=Options loop=$attribute.class_content.options
<option value="$Options.item.id|wash" if $selected_id_array|contains( $Options.item.id )selected="selected"/if>$Options.item.name|wash( xhtml )</option>
/section
</select>
/let
/defaultOverride them for one class attribute in an override.ini.append.php with Source=content/datatype/view/ezselection.tpl and a match on attribute_identifier (see A template override).
Related
Generated by ./console exp:help:examples from kernel/classes/datatypes/ezselection/ezselectiontype.php, settings/content.ini, design/standard/templates/content/datatype/view/ezselection.tpl, design/standard/templates/content/datatype/edit/ezselection.tpl. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.