diff --git a/core/includes/form.inc b/core/includes/form.inc index 87f8edf..6daf607 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -1225,29 +1225,32 @@ function form_pre_render_checkbox($element) { } /** - * Returns HTML for a set of checkbox form elements. + * Prepares variables for checkboxes templates. * - * @param $variables + * Default template: checkboxes.html.twig. + * + * @param array $variables * An associative array containing: * - element: An associative array containing the properties of the element. * Properties used: #children, #attributes. - * - * @ingroup themeable */ -function theme_checkboxes($variables) { +function template_preprocess_checkboxes(&$variables) { $element = $variables['element']; - $attributes = array(); if (isset($element['#id'])) { - $attributes['id'] = $element['#id']; + $variables['attributes']['id'] = $element['#id']; } - $attributes['class'][] = 'form-checkboxes'; + $variables['attributes']['class'] = array(); + $variables['attributes']['class'][] = 'form-checkboxes'; if (!empty($element['#attributes']['class'])) { - $attributes['class'] = array_merge($attributes['class'], $element['#attributes']['class']); + $variables['attributes']['class'] = array_merge($variables['attributes']['class'], $element['#attributes']['class']); } if (isset($element['#attributes']['title'])) { - $attributes['title'] = $element['#attributes']['title']; + $variables['attributes']['title'] = $element['#attributes']['title']; } - return '' . (!empty($element['#children']) ? $element['#children'] : '') . ''; + $variables['children'] = (!empty($element['#children'])) ? $element['#children'] : ''; + + // Remove the disabled attribute on the wrapper. + unset($variables['attributes']['disabled']); } /** diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 7fd8de4..34ec5f3 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2677,6 +2677,7 @@ function drupal_common_theme() { ), 'checkboxes' => array( 'render element' => 'element', + 'template' => 'checkboxes', ), 'form' => array( 'render element' => 'element', diff --git a/core/modules/system/templates/checkboxes.html.twig b/core/modules/system/templates/checkboxes.html.twig new file mode 100644 index 0000000..00384d3 --- /dev/null +++ b/core/modules/system/templates/checkboxes.html.twig @@ -0,0 +1,17 @@ +{# +/** + * @file + * Default theme implementation for a 'checkboxes' #type form element. + * + * Available variables + * - attributes: A list of HTML attributes for the wrapper element. + * - children: The rendered checkboxes. + * + * @see template_preprocess_checkboxes() + * + * @ingroup themeable + */ + @todo: remove this file once http://drupal.org/node/1819284 is resolved. + This is identical to core/modules/system/templates/container.html.twig +#} +{{ children }}