1{#** 2 * Copyright since 2007 PrestaShop SA and Contributors 3 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA 4 * 5 * NOTICE OF LICENSE 6 * 7 * This source file is subject to the Open Software License (OSL 3.0) 8 * that is bundled with this package in the file LICENSE.md. 9 * It is also available through the world-wide-web at this URL: 10 * https://opensource.org/licenses/OSL-3.0 11 * If you did not receive a copy of the license and are unable to 12 * obtain it through the world-wide-web, please send an email 13 * to license@prestashop.com so we can send you a copy immediately. 14 * 15 * DISCLAIMER 16 * 17 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer 18 * versions in the future. If you wish to customize PrestaShop for your 19 * needs please refer to https://devdocs.prestashop.com/ for more information. 20 * 21 * @author PrestaShop SA and Contributors <contact@prestashop.com> 22 * @copyright Since 2007 PrestaShop SA and Contributors 23 * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) 24 *#} 25 26{# 27# This form theme is an implementation of PrestaShop UI kit, it based on the bootstrap4 layout and overrides a few 28# blocks to match our expected integration of the UI kit. 29# 30# This theme uses/extends the basic bootstrap_4_horizontal_layout meaning the form labels/inputs are displayed 31# are displayed horizontally in a column way. 32# 33# Unlike our prestashop_ui_kit_base.html.twig theme which is the parent of this theme and is based on bootstrap_4_layout 34# where labels/inputs are displayed one under the other. 35#} 36 37{% use 'bootstrap_4_horizontal_layout.html.twig' %} 38{% use '@PrestaShop/Admin/TwigTemplateForm/prestashop_ui_kit_base.html.twig' %} 39 40{# overrides from bootstrap_4_horizontal_layout #} 41 42{% block form_start -%} 43 {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-horizontal')|trim}) %} 44 {{- parent() -}} 45{%- endblock form_start %} 46 47{# Labels #} 48 49{% block form_label -%} 50 {% spaceless %} 51 {% if label is same as(null) %} 52 <div class="{{ block('form_label_class') }}"></div> 53 {% elseif label is same as(false) %} 54 {# Use false as label is you don't want an empty column #} 55 {% else %} 56 {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) %} 57 {{- parent() -}} 58 {% endif %} 59 {% endspaceless %} 60{%- endblock form_label %} 61 62{% block form_label_class -%} 63 form-control-label 64{%- endblock form_label_class %} 65 66{# Rows #} 67 68{% block form_row -%} 69 {% spaceless %} 70 {# In horizontal theme when using a title for label it needs to be outside of the row div #} 71 {% if label_tag_name is defined %} 72 {{ form_label(form) }} 73 {% endif %} 74 75 {% import '@PrestaShop/Admin/macros.html.twig' as ps %} 76 {% set multistoreCheckboxName = multistore_field_prefix ~ form.vars.name %} 77 {% set disabledField = false %} 78 {% if form.vars.attr.disabled is defined and form.vars.attr.disabled %} 79 {% set disabledField = true %} 80 {% endif %} 81 82 <div class="{{ block('form_row_class') }}{{ block('widget_type_class') }}{% if (not compound or force_error|default(false)) and not valid %} has-error{% endif %}{% if (attr.visible is defined and not attr.visible) %} d-none{% endif %}"> 83 {% if attribute(form.parent, multistoreCheckboxName) is defined %} 84 {{ form_errors(attribute(form.parent, multistoreCheckboxName)) }} 85 {{ form_widget(attribute(form.parent, multistoreCheckboxName)) }} 86 {% endif %} 87 88 {% if label_tag_name is not defined %} 89 {{ form_label(form) }} 90 {% endif %} 91 <div class="{{ block('form_group_class') }}{% if disabledField %} disabled{% endif %}"> 92 {{ form_widget(form) }} 93 {{ form_errors(form, {'attr': {'fieldError': true}}) }} 94 </div> 95 {% if attribute(form.parent, form.vars.name) is defined and attribute(form.parent, form.vars.name).vars.multistore_dropdown != false %} 96 {{ attribute(form.parent, form.vars.name).vars.multistore_dropdown | raw }} 97 {% endif %} 98 99 {{- block('form_external_link') -}} 100 {{- block('form_alert') -}} 101 </div> 102 {% endspaceless %} 103 104 {% if column_breaker %} 105 <div class="form-group form-column-breaker"></div> 106 {% endif %} 107{%- endblock form_row %} 108 109{% block form_group_class -%} 110 col-sm input-container 111{%- endblock form_group_class %} 112 113{% block form_row_class -%} 114 form-group row{% if row_attr.class is defined %} {{ row_attr.class }}{% endif %} 115{%- endblock form_row_class %} 116