From 5a9de59616509bf9dc28daec825956a220eda4de Mon Sep 17 00:00:00 2001 From: Lauri Eskola <lauri.eskola@acquia.com> Date: Wed, 15 Jan 2020 17:27:20 +0200 Subject: [PATCH] Issue #3105580 by Hardik_Patel_12, siddhant.bhosale: Move HTML classes from claro_preprocess_checkboxes to a template --- core/themes/claro/claro.theme | 7 ------- .../claro/templates/form/checkboxes.html.twig | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 core/themes/claro/templates/form/checkboxes.html.twig diff --git a/core/themes/claro/claro.theme b/core/themes/claro/claro.theme index 5f772396ef1d..ad36e76cbc0a 100644 --- a/core/themes/claro/claro.theme +++ b/core/themes/claro/claro.theme @@ -861,13 +861,6 @@ function claro_preprocess_form_element__password(&$variables) { } } -/** - * Implements template_preprocess_HOOK() for checkboxes. - */ -function claro_preprocess_checkboxes(&$variables) { - $variables['attributes']['class'][] = 'form-boolean-group'; -} - /** * Implements template_preprocess_HOOK() for radios. */ diff --git a/core/themes/claro/templates/form/checkboxes.html.twig b/core/themes/claro/templates/form/checkboxes.html.twig new file mode 100644 index 000000000000..b7bbb9148ff2 --- /dev/null +++ b/core/themes/claro/templates/form/checkboxes.html.twig @@ -0,0 +1,15 @@ +{# +/** + * @file + * Theme override 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() + */ + @todo: remove this file once https://www.drupal.org/node/1819284 is resolved. + This is identical to core/modules/system/templates/container.html.twig +#} +<div{{ attributes.addClass('form-checkboxes','form-boolean-group') }}>{{ children }}</div> -- GitLab