summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2014-06-11 14:08:58 +0100
committerAlex Pott2014-06-11 14:08:58 +0100
commit406da3196aff04dd1b46e0974e770ba3aa38a213 (patch)
tree04a6d000c31de08b9f921c92bd67f8a326a27507
parent2858a837d418a2d901807860975d11b6c6224273 (diff)
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
-rw-r--r--core/includes/form.inc21
-rw-r--r--core/includes/theme.inc1
-rw-r--r--core/modules/system/templates/input.html.twig15
3 files changed, 20 insertions, 17 deletions
diff --git a/core/includes/form.inc b/core/includes/form.inc
index a85458a..5deb493 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -2326,31 +2326,18 @@ function form_process_autocomplete($element, &$form_state) {
}
/**
- * Preprocesses variables for theme_input().
+ * Prepares variables for input templates.
*
- * @param array $variables
- * 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.
+ * Default template: input.html.twig.
*
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #attributes.
- *
- * @ingroup themeable
*/
-function theme_input($variables) {
+function template_preprocess_input(&$variables) {
$element = $variables['element'];
- $attributes = $variables['attributes'];
- return '<input' . $attributes . ' />' . drupal_render_children($element);
+ $variables['children'] = $element['#children'];
}
/**
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index ed27b9c..fbcc619 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2629,6 +2629,7 @@ function drupal_common_theme() {
// From form.inc.
'input' => array(
'render element' => 'element',
+ 'template' => 'input',
),
'select' => array(
'render element' => 'element',
diff --git a/core/modules/system/templates/input.html.twig b/core/modules/system/templates/input.html.twig
new file mode 100644
index 0000000..1409c25
--- /dev/null
+++ b/core/modules/system/templates/input.html.twig
@@ -0,0 +1,15 @@
+{#
+/**
+ * @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 }}