Commit 406da319 authored by alexpott's avatar alexpott

Issue #2152219 by joelpittet, mdrummond, rodrigoaguilera, sqndr, rteijeiro,...

Issue #2152219 by joelpittet, mdrummond, rodrigoaguilera, sqndr, rteijeiro, InternetDevels, steveoliver, hussainweb, shanethehat, jenlampton, kpa, AnythonyR, EVIIILJ, kgoel, Cottser, dsdeiz, hanpersand: Convert theme_input() to Twig
parent 2858a837
...@@ -2326,31 +2326,18 @@ function form_process_autocomplete($element, &$form_state) { ...@@ -2326,31 +2326,18 @@ function form_process_autocomplete($element, &$form_state) {
} }
/** /**
* Preprocesses variables for theme_input(). * Prepares variables for input templates.
* *
* @param array $variables * Default template: input.html.twig.
* An associative array containing:
* - element: An associative array containing the properties of the element.
*/
function template_preprocess_input(&$variables) {
$element = $variables['element'];
$variables['attributes'] = new Attribute($element['#attributes']);
}
/**
* Returns HTML for an input form element.
* *
* @param array $variables * @param array $variables
* An associative array containing: * An associative array containing:
* - element: An associative array containing the properties of the element. * - element: An associative array containing the properties of the element.
* Properties used: #attributes. * Properties used: #attributes.
*
* @ingroup themeable
*/ */
function theme_input($variables) { function template_preprocess_input(&$variables) {
$element = $variables['element']; $element = $variables['element'];
$attributes = $variables['attributes']; $variables['children'] = $element['#children'];
return '<input' . $attributes . ' />' . drupal_render_children($element);
} }
/** /**
......
...@@ -2629,6 +2629,7 @@ function drupal_common_theme() { ...@@ -2629,6 +2629,7 @@ function drupal_common_theme() {
// From form.inc. // From form.inc.
'input' => array( 'input' => array(
'render element' => 'element', 'render element' => 'element',
'template' => 'input',
), ),
'select' => array( 'select' => array(
'render element' => 'element', 'render element' => 'element',
......
{#
/**
* @file
* Default theme implementation for an 'input' #type form element.
*
* Available variables:
* - attributes: A list of HTML attributes for the input element.
* - children: Optional additional rendered elements.
*
* @see template_preprocess_input()
*
* @ingroup themeable
*/
#}
<input{{ attributes }} />{{ children }}
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