'
', '#weight' => 100, ); $variables['title_suffix']['shortcut_wrapper'] = array( '#markup' => '
', '#weight' => -99, ); // Make sure the shortcut link is the first item in title_suffix. $variables['title_suffix']['add_or_remove_shortcut']['#weight'] = -100; } } /** * Implements hook_preprocess_HOOK() for maintenance-page.html.twig. */ function bartik_preprocess_maintenance_page(&$variables) { // By default, site_name is set to Drupal if no db connection is available // or during site installation. Setting site_name to an empty string makes // the site and update pages look cleaner. // @see template_preprocess_maintenance_page if (!$variables['db_is_active']) { $variables['site_name'] = ''; } // Bartik has custom styling for the maintenance page. $variables['#attached']['library'][] = 'bartik/maintenance_page'; // Set the options that apply to both page and maintenance page. _bartik_process_page($variables); } /** * Implements hook_preprocess_HOOK() for node.html.twig. */ function bartik_preprocess_node(&$variables) { // Remove the "Add new comment" link on teasers or when the comment form is // displayed on the page. if ($variables['teaser'] || !empty($variables['content']['comments']['comment_form'])) { unset($variables['content']['links']['comment']['#links']['comment-add']); } } /** * Implements hook_preprocess_HOOK() for block.html.twig. */ function bartik_preprocess_block(&$variables) { // Add a clearfix class to system branding blocks. if ($variables['plugin_id'] == 'system_branding_block') { $variables['attributes']['class'][] = 'clearfix'; } } /** * Implements hook_preprocess_HOOK() for menu.html.twig. */ function bartik_preprocess_menu(&$variables) { $variables['attributes']['class'][] = 'clearfix'; } /** * Helper function for handling the site name and slogan. */ function _bartik_process_page(&$variables) { $site_config = \Drupal::config('system.site'); // Always print the site name and slogan, but if they are toggled off, we'll // just hide them visually. $variables['hide_site_name'] = theme_get_setting('features.name') ? FALSE : TRUE; $variables['hide_site_slogan'] = theme_get_setting('features.slogan') ? FALSE : TRUE; if ($variables['hide_site_name']) { // If toggle_name is FALSE, the site_name will be empty, so we rebuild it. $variables['site_name'] = SafeMarkup::checkPlain($site_config->get('name')); } if ($variables['hide_site_slogan']) { // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we // rebuild it. $variables['site_slogan'] = Xss::filterAdmin($site_config->get('slogan')); } }