From 3b2266168eb94d2a0f2c601ca379d5481739f690 Mon Sep 17 00:00:00 2001 From: Florent Torregrosa Date: Sun, 10 Jul 2016 11:16:13 +0200 Subject: [PATCH] Issue #2762091: Select multiple field has an unwanted ::after icon --- templates/input/select-element.html.twig | 31 +++++++++++++++++++++++++++++++ templates/input/select.html.twig | 25 +++++++------------------ 2 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 templates/input/select-element.html.twig diff --git a/templates/input/select-element.html.twig b/templates/input/select-element.html.twig new file mode 100644 index 0000000..941018b --- /dev/null +++ b/templates/input/select-element.html.twig @@ -0,0 +1,31 @@ +{# +/** + * @file + * Include for a select element. + * + * Available variables: + * - attributes: HTML attributes for the select tag. + * - input_group: Flag to display as an input group. + * - options: The option element children. + * - prefix: Markup to display before the input element. + * - suffix: Markup to display after the input element. + * + * @ingroup templates + */ +#} +{% set classes = ['form-control'] %} + + {% for option in options %} + {% if option.type == 'optgroup' %} + + {% for sub_option in option.options %} + + {% endfor %} + + {% elseif option.type == 'option' %} + + {% endif %} + {% endfor %} + diff --git a/templates/input/select.html.twig b/templates/input/select.html.twig index c5641ec..56f93a0 100644 --- a/templates/input/select.html.twig +++ b/templates/input/select.html.twig @@ -28,24 +28,13 @@ # around the select element to style it properly. # @see http://stackoverflow.com/q/21103542 #} -
- {% set classes = ['form-control'] %} - - {% for option in options %} - {% if option.type == 'optgroup' %} - - {% for sub_option in option.options %} - - {% endfor %} - - {% elseif option.type == 'option' %} - - {% endif %} - {% endfor %} - -
+ {% if attributes.offsetExists('multiple') %} + {% include 'select-element.html.twig' %} + {% else %} +
+ {% include 'select-element.html.twig' %} +
+ {% endif %} {% if suffix %} {{ suffix }} -- 2.1.4