The ezbinaryfile datatype (File)
Class eZBinaryFileType in kernel/classes/datatypes/ezbinaryfile/ezbinaryfiletype.php; identifier ezbinaryfile, 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_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; can be filled from an uploaded file.
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/ezbinaryfile.tpl:
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
if $attribute.content
<a href=concat( 'content/download/', $attribute.contentobject_id, '/', $attribute.id,'/version/', $attribute.version , '/file/', $attribute.content.original_filename|urlencode )|ezurl>$attribute.content.original_filename|wash( xhtml )</a> ($attribute.content.filesize|si( byte ))
/ifThe shipped template that edits it (attribute_edit_gui), design/standard/templates/content/datatype/edit/ezbinaryfile.tpl (first 25 lines):
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
default attribute_base=ContentObjectAttribute
{* Current file. *}
<div class="block">
<label>'Current file'|i18n( 'design/standard/content/datatype' ):</label>
if $attribute.content
<table class="list" cellspacing="0">
<tr>
<th>'Filename'|i18n( 'design/standard/content/datatype' )</th>
<th>'MIME type'|i18n( 'design/standard/content/datatype' )</th>
<th>'Size'|i18n( 'design/standard/content/datatype' )</th>
</tr>
<tr>
<td>$attribute.content.original_filename|wash( xhtml )</td>
<td>$attribute.content.mime_type|wash( xhtml )</td>
<td>$attribute.content.filesize|si( byte )</td>
</tr>
</table>
else
<p>'There is no file.'|i18n( 'design/standard/content/datatype' )</p>
/if
if $attribute.content
<input class="button" type="submit" name="CustomActionButton[$attribute.id_delete_binary]" value="'Remove'|i18n( 'design/standard/content/datatype' )" title="'Remove the file from this draft.'|i18n( 'design/standard/content/datatype' )" />Override them for one class attribute in an override.ini.append.php with Source=content/datatype/view/ezbinaryfile.tpl and a match on attribute_identifier (see A template override).
Related
Generated by ./console exp:help:examples from kernel/classes/datatypes/ezbinaryfile/ezbinaryfiletype.php, settings/content.ini, design/standard/templates/content/datatype/view/ezbinaryfile.tpl, design/standard/templates/content/datatype/edit/ezbinaryfile.tpl. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.