Commit 82bb0f33 authored by webchick's avatar webchick

Issue #2152225 by longwave, JeroenT, steveoliver, joelpittet, hussainweb,...

Issue #2152225 by longwave, JeroenT, steveoliver, joelpittet, hussainweb, shanethehat, jenlampton, kpa, AnythonyR, EVIIILJ, kgoel, Cottser, dsdeiz, hanpersand: Convert theme_select() to Twig
parent b6ffa568
......@@ -876,7 +876,9 @@ function form_process_select($element) {
}
/**
* Returns HTML for a select form element.
* Prepares variables for select element templates.
*
* Default template: select.html.twig.
*
* It is possible to group options together; to do this, change the format of
* $options to an associative array in which the keys are group labels, and the
......@@ -887,15 +889,14 @@ function form_process_select($element) {
* - element: An associative array containing the properties of the element.
* Properties used: #title, #value, #options, #description, #extra,
* #multiple, #required, #name, #attributes, #size.
*
* @ingroup themeable
*/
function theme_select($variables) {
function template_preprocess_select(&$variables) {
$element = $variables['element'];
element_set_attributes($element, array('id', 'name', 'size'));
_form_set_attributes($element, array('form-select'));
return '<select' . new Attribute($element['#attributes']) . '>' . form_select_options($element) . '</select>';
$variables['attributes'] = $element['#attributes'];
$variables['options'] = form_select_options($element);
}
/**
......
......@@ -2591,6 +2591,7 @@ function drupal_common_theme() {
),
'select' => array(
'render element' => 'element',
'template' => 'select',
),
'fieldset' => array(
'render element' => 'element',
......
{#
/**
* @file
* Default theme implementation for a select element.
*
* Available variables:
* - attributes: HTML attributes for the select tag.
* - options: The option element children.
*
* @see template_preprocess_select()
*
* @ingroup themeable
*/
#}
<select{{ attributes }}>{{ options }}</select>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment