{#** * Copyright since 2007 PrestaShop SA and Contributors * PrestaShop is an International Registered Trademark & Property of PrestaShop SA * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.md. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to https://devdocs.prestashop.com/ for more information. * * @author PrestaShop SA and Contributors * @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) *#} {% use '@PrestaShop/Admin/TwigTemplateForm/form_div_layout.html.twig' %} {% use '@PrestaShop/Admin/TwigTemplateForm/typeahead.html.twig' %} {% use '@PrestaShop/Admin/TwigTemplateForm/material.html.twig' %} {% use '@PrestaShop/Admin/TwigTemplateForm/translatable_choice.html.twig' %} {# Widgets #} {% block form_widget_simple -%} {% if type is not defined or 'file' != type %} {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%} {% endif %} {{- parent() -}} {%- endblock form_widget_simple %} {% block textarea_widget -%} {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) %} {{- parent() -}} {%- endblock textarea_widget %} {% block button_widget -%} {% set attr = attr|merge({class: (attr.class|default('btn-default') ~ ' btn')|trim}) %} {{- parent() -}} {%- endblock %} {% block money_widget -%}
{% set prepend = '{{' == money_pattern[0:2] %} {% if not prepend %}
{{ money_pattern|replace({ '{{ widget }}':''}) }}
{% endif %} {{- block('form_widget_simple') -}} {% if prepend %}
{{ money_pattern|replace({ '{{ widget }}':''}) }}
{% endif %}
{%- endblock money_widget %} {% block percent_widget -%}
{{- block('form_widget_simple') -}}
%
{%- endblock percent_widget %} {% block datetime_widget -%} {% if widget == 'single_text' %} {{- block('form_widget_simple') -}} {% else -%} {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%}
{{- form_errors(form.date) -}} {{- form_errors(form.time) -}} {{- form_widget(form.date, { datetime: true } ) -}} {{- form_widget(form.time, { datetime: true } ) -}}
{%- endif %} {%- endblock datetime_widget %} {% block date_widget -%} {% if widget == 'single_text' %} {{- block('form_widget_simple') -}} {% else -%} {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} {% if datetime is not defined or not datetime -%}
{%- endif %} {{- date_pattern|replace({ '{{ year }}': form_widget(form.year), '{{ month }}': form_widget(form.month), '{{ day }}': form_widget(form.day), })|raw -}} {% if datetime is not defined or not datetime -%}
{%- endif -%} {% endif %} {%- endblock date_widget %} {% block time_widget -%} {% if widget == 'single_text' %} {{- block('form_widget_simple') -}} {% else -%} {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} {% if datetime is not defined or false == datetime -%}
{%- endif -%} {{- form_widget(form.hour) }}:{{ form_widget(form.minute) }}{% if with_seconds %}:{{ form_widget(form.second) }}{% endif %} {% if datetime is not defined or false == datetime -%}
{%- endif -%} {% endif %} {%- endblock time_widget %} {% block choice_widget_collapsed -%} {% set attr = attr|merge({class: (attr.class|default('') ~ ' custom-select')|trim}) %} {%- set attr = attr|merge({'aria-label': '%inputId% input'|trans({'%inputId%': form.vars.id}, 'Admin.Global')}) -%} {{- parent() -}} {%- endblock %} {% block choice_widget_expanded -%} {% if '-inline' in label_attr.class|default('') -%}
{%- for child in form %} {{- form_widget(child, { parent_label_class: label_attr.class|default(''), translation_domain: choice_translation_domain, }) -}} {% endfor -%}
{%- else -%}
{%- for child in form %} {{- form_widget(child, { parent_label_class: label_attr.class|default(''), translation_domain: choice_translation_domain, }) -}} {% endfor -%}
{%- endif %} {%- endblock choice_widget_expanded %} {% block checkbox_widget -%} {% set parent_label_class = parent_label_class|default('') -%} {% if 'checkbox-inline' in parent_label_class %} {{- form_label(form, null, { widget: parent() }) -}} {% else -%}
{{- form_label(form, null, { widget: parent() }) -}}
{%- endif %} {%- endblock checkbox_widget %} {% block radio_widget -%} {%- set parent_label_class = parent_label_class|default('') -%} {% if 'radio-inline' in parent_label_class %} {{- form_label(form, null, { widget: parent() }) -}} {% else -%}
{{- form_label(form, null, { widget: parent() }) -}}
{%- endif %} {%- endblock radio_widget %} {% block choice_tree_widget -%}
{%- endblock choice_tree_widget %} {% block choice_tree_item_widget -%} {% set checked = (form.vars.submitted_values is defined and submitted_values[child.id_category] is defined) %} {% if multiple -%}
{%- else -%}
{%- endif %} {% if child.children is defined %} {% for item in child.children %} {% set child = item %} {{ block('choice_tree_item_widget') }} {% endfor -%} {% endif %} {%- endblock choice_tree_item_widget %} {% block translatefields_widget %} {{ form_errors(form) }}
{% if hideTabs == false and form|length > 1 %} {% endif %}
{% for translationsFields in form %}
{{ form_errors(translationsFields) }} {{ form_widget(translationsFields) }} {{- block('form_help') -}}
{% endfor %}
{% endblock %} {% block translate_fields_widget -%} {% if type is not defined or 'file' != type %} {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%} {% endif %} {{- parent() -}} {%- endblock translate_fields_widget %} {% block translate_text_widget -%} {{ form_errors(form) }}
{% for translateField in form %} {% set classes = translateField.vars.attr.class|default('') ~ ' js-locale-input'%} {% set classes = classes ~ ' js-locale-' ~ translateField.vars.label %} {% if default_locale.id_lang != translateField.vars.name %} {% set classes = classes ~ ' d-none' %} {% endif %} {% set attr = translateField.vars.attr %} {{ form_widget(translateField, {attr: {'class': classes|trim}}) }} {% endfor %} {% if not hide_locales %} {% endif %}
{%- endblock translate_text_widget %} {% block translate_textarea_widget -%} {{ form_errors(form) }}
{% for textarea in form %} {% set classes = textarea.vars.attr.class|default('') ~ ' js-locale-input'%} {% set classes = classes ~ ' js-locale-' ~ textarea.vars.label %} {% if default_locale.id_lang != textarea.vars.name %} {% set classes = classes ~ ' d-none' %} {% endif %}
{{ form_widget(textarea, {attr: {'class': classes|trim}}) }}
{% endfor %} {% if show_locale_select %} {% endif %}
{%- endblock translate_textarea_widget %} {% block date_picker_widget %} {% apply spaceless %} {% set attr = attr|merge({'class': ((attr.class|default('') ~ ' datepicker form-control')|trim)}) %} {%- set attr = attr|merge({'aria-label': '%inputId% input'|trans({'%inputId%': form.vars.id}, 'Admin.Global')}) -%}
date_range
{% endapply %} {% endblock date_picker_widget %} {% block date_range_widget %} {% apply spaceless %} {{ form_widget(form.from) }} {{ form_errors(form.from) }} {{ form_widget(form.to) }} {{ form_errors(form.to) }} {% endapply %} {% endblock date_range_widget %} {% block color_picker_widget %} {% apply spaceless %} {% set attr = attr|merge({'class': ((attr.class|default('') ~ ' form-control colorpicker')|trim)}) %}
{% endapply %} {% endblock color_picker_widget %} {% block search_and_reset_widget %} {% apply spaceless %} {% if show_reset_button %}
{% endif %} {% endapply %} {% endblock search_and_reset_widget %} {% block switch_widget %} {% apply spaceless %} {% for choice in choices %} {% set inputId = id ~'_' ~ choice.value %} {% endfor %} {% endapply %} {% endblock switch_widget %} {% block _form_step6_attachments_widget %}
{{ 'There is no attachment yet.'|trans({}, 'Admin.Catalog.Notification') }}
{%- for child in form %} {% endfor -%}
{{ 'Title'|trans({}, 'Admin.Global') }} {{ 'File name'|trans({}, 'Admin.Global') }} {{ 'Type'|trans({}, 'Admin.Catalog.Feature') }}
{{ form_widget(child) }} {{ form.vars.attr.data[loop.index0]['file_name'] }} {{ form.vars.attr.data[loop.index0]['mime'] }}
{% endblock %} {# Labels #} {% block form_label -%} {{- parent() -}} {%- endblock form_label %} {% block choice_label -%} {# remove the checkbox-inline and radio-inline class, it's only useful for embed labels #} {%- set label_attr = label_attr|merge({class: label_attr.class|default('')|replace({'checkbox-inline': '', 'radio-inline': ''})|trim}) -%} {{- block('form_label') -}} {% endblock %} {% block checkbox_label -%} {{- block('checkbox_radio_label') -}} {%- endblock checkbox_label %} {% block radio_label -%} {{- block('checkbox_radio_label') -}} {%- endblock radio_label %} {% block checkbox_radio_label %} {# Do not display the label if widget is not defined in order to prevent double label rendering #} {% if widget is defined %} {% if required %} {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %} {% endif %} {% if parent_label_class is defined %} {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %} {% endif %} {% if label is not same as(false) and label is empty %} {% set label = name|humanize %} {% endif %} {% if material_design is defined or attr.material_design is defined %}
{{- widget|raw -}} {{- label is not same as(false) ? (translation_domain is same as(false) ? label|raw : label|raw) -}}
{% else %} {{- widget|raw -}} {{- label is not same as(false) ? (translation_domain is same as(false) ? label|raw : label|raw) -}} {% endif %} {% endif %} {% endblock checkbox_radio_label %} {# Rows #} {% block form_row -%}
{{- form_label(form) -}} {{- form_widget(form) -}} {{- form_errors(form) -}}
{%- endblock form_row %} {% block button_row -%} {% set rowClass = "form-group " ~ form.vars.row_attr.class|default('')|trim %}
{{- form_widget(form) -}}
{%- endblock button_row %} {% block choice_row -%} {% set force_error = true %} {{- block('form_row') }} {%- endblock choice_row %} {% block date_row -%} {% set force_error = true %} {{- block('form_row') }} {%- endblock date_row %} {% block time_row -%} {% set force_error = true %} {{- block('form_row') }} {%- endblock time_row %} {% block datetime_row -%} {% set force_error = true %} {{- block('form_row') }} {%- endblock datetime_row %} {% block checkbox_row -%}
{{- form_widget(form) -}} {{- form_errors(form) -}}
{%- endblock checkbox_row %} {% block radio_row -%}
{{- form_widget(form) -}} {{- form_errors(form) -}}
{%- endblock radio_row %} {# Errors #} {% block form_errors -%} {% if errors|length > 0 -%}
{%- if errors|length > 1 -%}
    {%- for error in errors -%}
  • {{ error.messagePluralization is null ? error.messageTemplate|trans(error.messageParameters, 'form_error') : error.messageTemplate|transchoice(error.messagePluralization, error.messageParameters, 'form_error') }}
  • {%- endfor -%}
{%- else -%}
{%- for error in errors -%}

{{ error.messagePluralization is null ? error.messageTemplate|trans(error.messageParameters, 'form_error') : error.messageTemplate|transchoice(error.messagePluralization, error.messageParameters, 'form_error') }}

{%- endfor -%}
{%- endif -%}
{%- endif %} {%- endblock form_errors %} {# Material design widgets #} {% block material_choice_table_widget %} {% apply spaceless %}
{% for child in form %} {% endfor %}
{{ form_widget(child, {'material_design': true}) }}
{% endapply %} {% endblock material_choice_table_widget %} {% block material_multiple_choice_table_widget %} {% apply spaceless %}
{% for child_choice in form %} {% endfor %} {% for choice_name, choice_value in choices %} {% for child_choice_name, child_choice in form %} {% endfor %} {% endfor %}
{{ label }} {% if child_choice.vars.multiple and child_choice.vars.name not in headers_to_disable %} {{ child_choice.vars.label }} {% else %} {{ child_choice.vars.label }} {% endif %}
{{ choice_name }} {% if child_choice_entry_index_mapping[choice_value][child_choice_name] is defined %} {% set entry_index = child_choice_entry_index_mapping[choice_value][child_choice_name] %} {% if child_choice.vars.multiple %} {{ form_widget(child_choice[entry_index], {'material_design': true}) }} {% else %} {{ form_widget(child_choice[entry_index]) }} {% endif %} {% else %} -- {% endif %}
{% endapply %} {% endblock material_multiple_choice_table_widget %} {% block translatable_widget -%} {% set formClass = form.vars.attr.class|default('') ~ ' input-group locale-input-group js-locale-input-group d-flex'|trim %}
{% for translateField in form %} {% set classes = translateField.vars.attr.class|default('') ~ ' js-locale-input'%} {% set classes = classes ~ ' js-locale-' ~ translateField.vars.label %} {% if default_locale.id_lang != translateField.vars.name %} {% set classes = classes ~ ' d-none' %} {% endif %}
{{ form_widget(translateField) }}
{% endfor %} {% if not hide_locales %} {% endif %}
{%- endblock translatable_widget %} {% block birthday_widget %} {% if widget == 'single_text' %} {{- block('form_widget_simple') -}} {% else -%} {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-inline')|trim}) -%} {% if datetime is not defined or not datetime -%}
{%- endif %} {% set yearWidget = '
' ~ form_widget(form.year) ~ '
'|raw %} {% set monthWidget = '
' ~ form_widget(form.month) ~ '
'|raw %} {% set dayWidget = '
' ~ form_widget(form.day) ~ '
'|raw %} {{- date_pattern|replace({ '{{ year }}': yearWidget, '{{ month }}': monthWidget, '{{ day }}': dayWidget, })|raw -}} {% if datetime is not defined or not datetime -%}
{%- endif -%} {% endif %} {% endblock birthday_widget %} {% block file_widget %}
{% set attr = attr|merge({ class: (attr.class|default('') ~ ' custom-file-input')|trim, 'data-multiple-files-text': '%count% file(s)'|trans({}, 'Admin.Global'), 'data-locale': get_context_iso_code() }) -%} {% if attr.disabled is defined and attr.disabled %} {% set attr = attr|merge({ class: attr.class ~ ' disabled' }) %} {% endif %} {{ form_widget(form, {'attr': attr}) }}
{% endblock file_widget %} {% block shop_restriction_checkbox_widget %} {% if form.vars.attr.is_allowed_to_display %}
{% endif %} {% endblock %} {% block generatable_text_widget %}
{{- block('form_widget') -}}
{% endblock generatable_text_widget %} {% block text_with_recommended_length_widget %} {% set attr = attr|merge({ 'data-recommended-length-counter': '#' ~ id ~ '_recommended_length_counter', 'class': 'js-recommended-length-input' }) -%} {% if input_type == 'textarea' %} {{- block('textarea_widget') -}} {% else %} {{- block('form_widget_simple') -}} {% endif %} {{ '[1][/1] of [2][/2] characters used (recommended)'|trans({}, 'Admin.Catalog.Feature')|replace({ '[1]': '' ~ value|length, '[/1]': '', '[2]': '' ~ recommended_length, '[/2]': '', })|raw }} {% endblock text_with_recommended_length_widget %} {% block integer_min_max_filter_widget %} {{ form_widget(form['min_field'], { attr: {class: 'min-field'}}) }} {{ form_widget(form['max_field'], { attr: {class: 'max-field'}}) }} {% endblock %} {% block number_min_max_filter_widget %} {{ form_widget(form['min_field'], { attr: {class: 'min-field'}}) }} {{ form_widget(form['max_field'], { attr: {class: 'max-field'}}) }} {% endblock %} {% block form_help %} {% if help %} {{ help }} {% endif %} {% endblock form_help %} {% block form_hint %} {% if hint %}
{{ hint|raw }}
{% endif %} {% endblock form_hint %} {% block custom_content_widget %} {% include template with data %} {% endblock %} {% block text_widget %} {%- set attr = attr|merge({'aria-label': '%inputId% input'|trans({'%inputId%': form.vars.id}, 'Admin.Global')}) -%} {% if data_list is not null %} {%- set attr = attr|merge({'list': id ~ '_datalist'}) -%} {% endif %} {{ form_widget(form, {'attr': attr}) }} {% if data_list is not null %} {% for item in data_list %} {% endfor%} {% endif %} {% endblock text_widget %}