Chris@3: '
', Chris@3: '#weight' => 100, Chris@3: ]; Chris@3: $variables['title_suffix']['shortcut_wrapper'] = [ Chris@3: '#markup' => '
', Chris@3: '#weight' => -99, Chris@3: ]; Chris@3: // Make sure the shortcut link is the first item in title_suffix. Chris@3: $variables['title_suffix']['add_or_remove_shortcut']['#weight'] = -100; Chris@3: } Chris@3: } Chris@3: Chris@3: /** Chris@3: * Implements hook_preprocess_HOOK() for maintenance-page.html.twig. Chris@3: */ Chris@3: function isobartik_preprocess_maintenance_page(&$variables) { Chris@3: // By default, site_name is set to Drupal if no db connection is available Chris@3: // or during site installation. Setting site_name to an empty string makes Chris@3: // the site and update pages look cleaner. Chris@3: // @see template_preprocess_maintenance_page Chris@3: if (!$variables['db_is_active']) { Chris@3: $variables['site_name'] = ''; Chris@3: } Chris@3: Chris@3: // Bartik has custom styling for the maintenance page. Chris@4: $variables['#attached']['library'][] = 'isobartik/maintenance_page'; Chris@3: } Chris@3: Chris@3: /** Chris@3: * Implements hook_preprocess_HOOK() for node.html.twig. Chris@3: */ Chris@3: function isobartik_preprocess_node(&$variables) { Chris@3: // Remove the "Add new comment" link on teasers or when the comment form is Chris@3: // displayed on the page. Chris@3: if ($variables['teaser'] || !empty($variables['content']['comments']['comment_form'])) { Chris@3: unset($variables['content']['links']['comment']['#links']['comment-add']); Chris@3: } Chris@3: } Chris@3: Chris@3: /** Chris@3: * Implements hook_preprocess_HOOK() for block.html.twig. Chris@3: */ Chris@3: function isobartik_preprocess_block(&$variables) { Chris@3: // Add a clearfix class to system branding blocks. Chris@3: if ($variables['plugin_id'] == 'system_branding_block') { Chris@3: $variables['attributes']['class'][] = 'clearfix'; Chris@3: } Chris@3: } Chris@3: Chris@3: /** Chris@3: * Implements hook_preprocess_HOOK() for menu.html.twig. Chris@3: */ Chris@3: function isobartik_preprocess_menu(&$variables) { Chris@3: $variables['attributes']['class'][] = 'clearfix'; Chris@3: } Chris@3: Chris@3: /** Chris@3: * Implements hook_theme_suggestions_HOOK_alter() for form templates. Chris@3: */ Chris@3: function isobartik_theme_suggestions_form_alter(array &$suggestions, array $variables) { Chris@3: if ($variables['element']['#form_id'] == 'search_block_form') { Chris@3: $suggestions[] = 'form__search_block_form'; Chris@3: } Chris@3: } Chris@3: Chris@3: /** Chris@3: * Implements hook_form_alter() to add classes to the search form. Chris@3: */ Chris@3: function isobartik_form_alter(&$form, FormStateInterface $form_state, $form_id) { Chris@3: if (in_array($form_id, ['search_block_form', 'search_form'])) { Chris@3: $key = ($form_id == 'search_block_form') ? 'actions' : 'basic'; Chris@3: if (!isset($form[$key]['submit']['#attributes'])) { Chris@3: $form[$key]['submit']['#attributes'] = new Attribute(); Chris@3: } Chris@3: $form[$key]['submit']['#attributes']->addClass('search-form__submit'); Chris@3: } Chris@3: }