{* This file bind a form field to an HTML representation. In addition to the standard form_field block output, this fragment uses the following additional variables : - field_id : the ID of the input field. Override the ID defined in the form definition - field_template : the template style ('standard', or somethingelse) - field_value : the value of the input field, which is used if the form_field value is empty. - field_extra_class : an extra class to add to the input class (see form-field-attributes-standard-renderer.html) - field_no_standard_classes : an extra class to add to the input class (see form-field-attributes-standard-renderer.html) - show_label : if false, the field label and help line should not be displayed. - content : if this variable is not empty, we assume that it contains the input field definition. Used by the custom_render_form_field block to pass a custom representation of the input field. *} {* Get standard fields attributes *} {capture assign=attributes}{include file="forms/$field_template/form-field-attributes-renderer.html"}{/capture} {* see form-field-attributes-renderer.html *} {* Use the provided id if any *} {if (!isset($label_attr.for))} {$label_attr.for = ""} {/if} {if (! empty($field_id))} {$label_attr.for = $field_id} {elseif empty({$label_attr.for|default:null})} {* Synthetize an ID if none was given *} {$label_attr.for = "{$form->getName()}-id-{$field_name}"} {/if} {* Use the optionnal $field_value parameter if no value is defined Do not use empty(), as empty(0), empty("0") are true *} {if ($value == '' || $value == null) && isset($field_value) && $field_value !== '' && $field_value !== null} {$value = $field_value} {/if} {if $type == 'hidden'} {if $content == ''} {else} {$content nofilter} {/if} {elseif $type == 'checkbox'}