diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme old mode 100644 new mode 100755 index d301f34..5d0c7d4 --- a/core/themes/bartik/bartik.theme +++ b/core/themes/bartik/bartik.theme @@ -122,13 +122,12 @@ function bartik_theme_suggestions_form_alter(array &$suggestions, array $variabl * Implements hook_form_alter() to add classes to the search form. */ function bartik_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { - if($form_id == 'search_block_form') { - $form['actions']['submit']['#attributes'] = new Attribute(); - $form['actions']['submit']['#attributes']->addClass('search-form__submit'); - } - if($form_id == 'search_form') { - $form['basic']['submit']['#attributes'] = new Attribute(); - $form['basic']['submit']['#attributes']->addClass('search-form__submit'); + if (in_array($form_id, ['search_block_form', 'search_form'])) { + $key = ($form_id == 'search_block_form') ? 'actions' : 'basic'; + if (!isset($form[$key]['submit']['#attributes'])) { + $form[$key]['submit']['#attributes'] = new Attribute(); + } + $form[$key]['submit']['#attributes']->addClass('search-form__submit'); } } diff --git a/core/themes/bartik/templates/form--search-block-form.html.twig b/core/themes/bartik/templates/form--search-block-form.html.twig old mode 100644 new mode 100755 index fa2753a..68847fc --- a/core/themes/bartik/templates/form--search-block-form.html.twig +++ b/core/themes/bartik/templates/form--search-block-form.html.twig @@ -3,15 +3,13 @@ * @file * Default theme implementation for a 'form' element. * - * Available variables + * 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 */ #} - + {{ children }}