diff --git a/core/includes/form.inc b/core/includes/form.inc index 20edb53..437934c 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -2679,16 +2679,16 @@ function form_pre_render_color($element) { } /** - * Returns HTML for a form. + * Prepares variables for form templates. + * + * Default template: form.html.twig. * * @param $variables * An associative array containing: * - element: An associative array containing the properties of the element. * Properties used: #action, #method, #attributes, #children - * - * @ingroup themeable */ -function theme_form($variables) { +function template_preprocess_form(&$variables) { $element = $variables['element']; if (isset($element['#action'])) { $element['#attributes']['action'] = UrlHelper::stripDangerousProtocols($element['#action']); @@ -2697,8 +2697,8 @@ function theme_form($variables) { if (empty($element['#attributes']['accept-charset'])) { $element['#attributes']['accept-charset'] = "UTF-8"; } - // Anonymous DIV to satisfy XHTML compliance. - return '
'; + $variables['attributes'] = $element['#attributes']; + $variables['children'] = $element['#children']; } /** diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 1526113..a8ce2a8 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2619,6 +2619,7 @@ function drupal_common_theme() { ), 'form' => array( 'render element' => 'element', + 'template' => 'form', ), 'textarea' => array( 'render element' => 'element', diff --git a/core/modules/system/templates/form.html.twig b/core/modules/system/templates/form.html.twig new file mode 100644 index 0000000..b95fe71 --- /dev/null +++ b/core/modules/system/templates/form.html.twig @@ -0,0 +1,15 @@ +{# +/** + * @file + * Default theme implementation for a 'form' element. + * + * Available variables + * - attributes: A list of HTML attributes for the wrapper element. + * - children: The child elements of the form. + * + * @see template_preprocess_form() + * + * @ingroup themeable + */ +#} +