{% extends 'form_div_layout.html.twig' %} {% block widget_container_attributes %} {% if errors|length > 0 %} {% set attr = attr|merge({'class': attr.class is defined ? attr.class ~ ' error' : 'error'}) %} {% endif %} {{ parent() }} {% endblock widget_container_attributes %} {% block date_widget %} {% spaceless %} {% set type = 'text' %} {% if widget == 'single_text' %} {{ block('form_widget_simple')|raw }} {% else %}
{{ date_pattern|replace({ '{{ year }}': form_widget(form.year), '{{ month }}': form_widget(form.month), '{{ day }}': form_widget(form.day), })|raw }}
{% endif %} {% endspaceless %} {% endblock date_widget %} {% block choice_widget_expanded %} {% spaceless %} {% set attr = attr|merge({'class': attr.class is defined ? attr.class ~ ' horizontal' : 'horizontal'}) %} {% set attr = attr|merge({'class': attr.class ~ ' validate-group'}) %} {% set attr = attr|merge({'class': attr.class ~ ' AknChoicesField'}) %}
{% for child in form %}
{{ form_widget(child) }} {{ form_label(child) }}
{% endfor %}
{% endspaceless %} {% endblock choice_widget_expanded %} {% block choice_widget_options %} {% spaceless %} {% for group_label, choice in options %} {% if choice is iterable %} {% set options = choice %} {{ block('choice_widget_options') }} {% else %} {% set label = choice_translation_domain is same as(false) ? choice.label : choice.label|trans({}, choice_translation_domain) %} {% endif %} {% endfor %} {% endspaceless %} {% endblock choice_widget_options %} {% block choice_widget_option_attributes %} {% spaceless %} {% if choice.label.attr is defined and choice.label.attr|length > 0 %} {% for attrname, attrvalue in choice.label.attr %}{{ attrname }}="{{ attrvalue }}" {% endfor %} {% endif %} {% endspaceless %} {% endblock choice_widget_option_attributes %} {% block form_start %} {% spaceless %} {% set method = method|upper %} {% if method in ["GET", "POST"] %} {% set form_method = method %} {% else %} {% set form_method = "POST" %} {% endif %} {% set formClass = class is defined ? class : 'form-horizontal' %} {% if attr.class is defined %} {% set class = attr.class ~ ' ' ~ formClass %} {% else %} {% set class = formClass %} {% endif %} {% set attr = attr|merge({'class': class }) %}
{% if form_method != method %} {% endif %} {% endspaceless %} {% endblock form_start %} {% block form_end %} {% spaceless %} {{ form_row(form._token) }}
{% endspaceless %} {% endblock form_end %} {% block form_row_field %}
{{ form_label(form, '', { label_attr: label_attr|merge({ class: 'AknFieldContainer-label control-label' })}) }}
{{ form_widget(form) }} {% if form.children|length == 0 %} {{ block('form_info') }} {% endif %}
{% endblock %} {% block form_row %} {% spaceless %} {{ block('form_row_field') }} {% endspaceless %} {% endblock form_row %} {% block form_label %} {% spaceless %} {% if label is not same as(false) %} {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' AknFieldContainer-label')|trim}) %} {% if not compound %} {% set label_attr = label_attr|merge({'for': id}) %} {% endif %} {% if required %} {% set label_attr = label_attr|merge({'class': (label_attr.class ~ ' required')|trim}) %} {% endif %} {% if label is empty %} {% set label = name|humanize %} {% endif %} {% set isRadioLabel = form.parent.vars.expanded|default(false) and checked is defined %} {% set label = label|trans({}, translation_domain) %} {% if label_attr.truncate is defined and label_attr.truncate %} {% set label_attr = { 'title': label }|merge(label_attr) %} {% set label_attr = label_attr|merge({ 'class': (label_attr.class is defined ? label_attr.class ~ ' ' : '') ~ 'truncate' }) %} {% endif %} {% if form.parent.vars.mode is defined and 'comparison' == form.parent.vars.mode %} {% else %} {{ label }}{% if required and not isRadioLabel %} {{ 'required'|trans }}{% endif %} {% endif %} {% endif %} {% endspaceless %} {% endblock form_label %} {% block form_info %} {% spaceless %} {% if type is not defined or type != 'hidden' %}
{% if help is defined %} {% endif %} {% if from_variant is defined %} {% endif %} {{ form_errors(form) }}
{% if info is defined %}
{{ info|trans }}
{% endif %} {% endif %} {% endspaceless %} {% endblock form_info %} {% macro getRootId(form) -%} {{ form.parent ? _self.getRootId(form.parent) : form.vars.id }} {%- endmacro %} {% block form_errors %}{% spaceless %} {% if errors|length > 0 %} {% if form.parent %} {% set combinedError = '' %} {% for error in errors %} {% set error = error.messagePluralization is null ? error.messageTemplate|trans(error.messageParameters, 'validators') : error.messageTemplate|transchoice(error.messagePluralization, error.messageParameters, 'validators') %} {% set combinedError = (combinedError != '') ? combinedError ~ '; ' ~ error : error %} {% endfor %} {% else %} {{ parent() }} {% endif %} {% endif %} {% endspaceless %}{% endblock form_errors %} {% block pim_translatable_field_row %} {{ form_errors(form) }} {% for translation in form %}
{{ form_label(translation) }}
{{ form_widget(translation) }} {% if form.children|length == 0 %} {{ block('form_info') }} {% endif %}
{% endfor %} {% endblock %} {% block pim_enrich_media_row %} {% spaceless %} {% set empty = not form.vars.value or not form.vars.value.key %} {% if not (empty and form.parent.vars.mode is defined and 'comparison' == form.parent.vars.mode) %}
{{ block('form_info') }} {{ form_widget(form.id) }}
{% else %}
{% endif %} {% endspaceless %} {% endblock %} {% block widget_attributes %} {% spaceless %} id="{{ id }}" name="{{ full_name }}"{% if attr.read_only is defined and attr.read_only == true %} readonly="readonly"{% endif %}{% if disabled %} disabled="disabled"{% endif %}{% if attr.max_length is defined %} maxlength="{{ max_length }}"{% endif %}{% if pattern is defined %} pattern="{{ pattern }}"{% endif %} {% for attrname, attrvalue in attr %}{% if attrname in ['placeholder', 'title'] %}{{ attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {% else %}{{ attrname }}="{{ attrvalue }}" {% endif %}{% endfor %} {% endspaceless %} {% endblock widget_attributes %} {% block switch_widget %} {% spaceless %} {% set originalId = id %} {% set id = 'input-' ~ originalId %} {% set switchId = 'switch-' ~ originalId %}
{% if required %}{% set required = false %}{% endif %}
{% endspaceless %} {% endblock switch_widget %} {% block pim_ajax_entity_row %} {{ block('form_row_field') }} {% endblock %} {% block pim_ajax_reference_data_row %} {{ block('form_row_field') }} {% endblock %} {% block pim_date_widget %} {% set attr = attr|merge({ 'class': (attr.class is defined ? attr.class ~ ' ' : '') ~ 'datepicker add-on', 'placeholder': placeholder|trans }) %} {% if form.vars.disabled %} {% set attr = attr|merge({'disabled': 'disabled'}) %} {% endif %} {{ block('date_widget') }} {% endblock pim_date_widget %} {% block pim_number_widget %} {{ block('number_widget') }} {% endblock %} {% block oro_acl_privilege_widget %} {% spaceless %} {% if 'groups' == privileges_config.view_type %} {% if 'entity' == form.vars.value.extensionKey and '(default)' != form.vars.value.identity.name %} {{ form_widget(form.identity.id) }} {{ form_widget(form.permissions) }} {% else %}
{{ form_widget(form.permissions) }} {{ form_widget(form.identity) }}
{% endif %} {% else %} {{ form_widget(form.identity) }} {{ form_widget(form.permissions) }} {% endif %} {% endspaceless %} {% endblock %} {% block oro_acl_permission_widget %} {{ form_widget(form.name) }} {{ form_widget(form.accessLevel) }} {% endblock %} {% block oro_acl_permission_collection_widget %} {% if 'entity' == form.parent.vars.value.extensionKey %} {% for field in privileges_config['permissions'] %} {% for permission in form if permission.vars.value.name == field %} {% set additionalClass = field == 'ASSIGN' or '(default)' == form.parent.vars.value.identity.name ? ' default-field hide' : '' %} {% if 'entity:Akeneo\\UserManagement\\Component\\Model\\Role' == form.parent.vars.value.identity.id %} {% set additionalClass = additionalClass ~ ' default-field-toggle' %} {% endif %}
{{ ('oro_security.acl.' ~ form.parent.vars.value.identity.name ~ '.' ~ field)|lower|trans }} {{ form_widget(permission) }}
{% endfor %} {% endfor %} {% else %} {% for field in privileges_config['permissions'] %} {% for permission in form if permission.vars.value.name == field %} {{ form_widget(permission) }} {% endfor %} {% endfor %} {% endif %} {% endblock %} {% block pim_acl_access_level_selector_widget %} {% set iconClass = '' %} {% if form.vars.checked %} {% set iconClass = 'AknSelectButton--selected granted' %} {% else %} {% set iconClass = 'non-granted' %} {% endif %}
{% set attr = attr|merge({ class: 'hide' }) %} {{ block('checkbox_widget') }} {% endblock %} {% block oro_acl_label_widget %} {{ value|trans }} {% endblock %} {% block pim_async_select_widget %} {% if attr['data-placeholder'] is defined %} {% set attr = attr|merge({'data-placeholder': attr['data-placeholder']|trans}) %} {% endif %} {{ block('hidden_widget') }} {% endblock %} {% block select_family_type_row %} {{ block('form_row_field') }} {% endblock %} {%- block form_widget_simple -%} {%- set type = type|default('text') -%} {% if attr.class is defined %} {% if 'input-' not in attr.class %} {% set class = attr.class ~ ' AknTextField' %} {% else %} {% set class = attr.class %} {% endif %} {% else %} {% set class = ' AknTextField' %} {% endif %} {% if 'file' == type %} {% set class = class ~ ' AknTextField--file' %} {% endif %} {% set attr = attr|merge({'class': class }) %} {# This override is needed until this twig PR is not merged: https://github.com/twigphp/Twig/pull/2433 #} {%- endblock form_widget_simple -%} {%- block textarea_widget -%} {%- endblock textarea_widget -%}