{# # --------------------------------------------------------------------- # # GLPI - Gestionnaire Libre de Parc Informatique # # http://glpi-project.org # # @copyright 2015-2024 Teclib' and contributors. # @copyright 2003-2014 by the INDEPNET Development Team. # @licence https://www.gnu.org/licenses/gpl-3.0.html # # --------------------------------------------------------------------- # # LICENSE # # This file is part of GLPI. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # --------------------------------------------------------------------- #} {# @var form Glpi\Form #} {# @var question_types_manager Glpi\Form\QuestionType\QuestionTypesManager #} {# @var question_type Glpi\Form\QuestionType\QuestionTypeInterface #} {# @var question Glpi\Form\Question|null #} {# @var section Glpi\Form\Section|null #} {# @var can_update bool #} {# @var allow_unauthenticated_access bool #} {% import 'components/form/fields_macros.html.twig' as fields %} {% set base_field_options = { 'is_horizontal': false, 'full_width' : true, 'no_label' : true, } %}
{# Display question's title #}
* {# Duplicate question #}
{# Render the specific question type #}
{{ question_type.renderAdministrationTemplate(question)|raw }}
{# Display common fields #}
{{ fields.textareaField( 'description', question is not null ? question.fields.description : '', __('Description'), base_field_options|merge({ 'placeholder': __('Add a description...'), 'aria_label': __("Question description"), 'enable_richtext': true, 'add_body_classes': ['content-editable-tinymce-editor', 'text-muted'], 'editor_height': "0", 'rows' : 1, 'toolbar_location': 'bottom', 'init': question is not null ? true : false, 'mb': 'mb-0', }) ) }}
{% set categories = {} %} {% for category in question_types_manager.getCategories() %} {% set categories = categories|merge({(category.value): category.getLabel()}) %} {% endfor %} {{ fields.dropdownArrayField( '_type_category', question_type.getCategory().value, categories, '', { 'init' : question is not null, 'no_label' : true, 'mb' : '', 'field_class' : 'me-2', 'class' : 'form-select form-select-sm', 'width' : 'auto', 'aria_label' : __('Question type'), 'add_data_attributes' : { 'glpi-form-editor-on-change': 'change-question-type-category' }, 'templateSelection' : question_types_manager.getTemplateSelectionForCategories(), 'templateResult' : question_types_manager.getTemplateResultForCategories(), } ) }} {% set types = question_types_manager.getTypesForCategory(question_type.getCategory()) %} {% for possible_question_type in types %} {% set types = types|merge({(get_class(possible_question_type)): possible_question_type.getName()}) %} {% endfor %} {{ fields.dropdownArrayField( 'type', get_class(question_type), types, question_type.getName(), { 'init' : question is not null, 'no_label' : true, 'mb' : '', 'field_class' : 'me-2' ~ (types|length == 1 ? ' d-none' : ''), 'class' : 'form-select form-select-sm', 'width' : 'auto', 'aria_label' : __('Question sub type'), 'add_data_attributes' : { 'glpi-form-editor-on-change' : 'change-question-type', 'glpi-form-editor-question-type-selector': '' }, 'templateSelection' : question_types_manager.getTemplateSelectionForQuestionTypes(), 'templateResult' : question_types_manager.getTemplateResultForQuestionTypes(), } ) }} {# Render the specific question options #}
{{ question_type.renderAdministrationOptionsTemplate(question)|raw }}
{# Common hidden data #}
{{ include('pages/admin/form/form_toolbar.html.twig', { 'can_update': can_update, 'form': form, }, with_context = false) }}