diff --git a/core/includes/form.inc b/core/includes/form.inc
index 20edb5305c9d053bbe597cdbabe36a901e4eb0c5..638f56c2573366add9827710af84cfdf89ef4327 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -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 '';
+ $variables['attributes'] = $element['#attributes'];
+ $variables['options'] = form_select_options($element);
}
/**
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 435b9da68b94b0c77340a7465ea54552c53c25a5..e35ef016105047ad33115e2e34d6b7b993c9e62e 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2591,6 +2591,7 @@ function drupal_common_theme() {
),
'select' => array(
'render element' => 'element',
+ 'template' => 'select',
),
'fieldset' => array(
'render element' => 'element',
diff --git a/core/modules/system/templates/select.html.twig b/core/modules/system/templates/select.html.twig
new file mode 100644
index 0000000000000000000000000000000000000000..21f32ac3c1a22e05195f39da8c06abb9fa760e29
--- /dev/null
+++ b/core/modules/system/templates/select.html.twig
@@ -0,0 +1,15 @@
+{#
+/**
+ * @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
+ */
+#}
+