addClass('no-js'); // Don't display the site name twice on the front page (and potentially others) /*if (isset($variables['head_title_array']['title']) && isset($variables['head_title_array']['name']) && ($variables['head_title_array']['title'] == $variables['head_title_array']['name'])) { $variables['head_title'] = $variables['head_title_array']['name']; }*/ } /** * Implements hook_page_attachments_alter(). */ function vue_js_page_attachments_alter(array &$page) { // Tell IE to use latest rendering engine (not to use compatibility mode). /*$ie_edge = [ '#type' => 'html_tag', '#tag' => 'meta', '#attributes' => [ 'http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge', ], ]; $page['#attached']['html_head'][] = [$ie_edge, 'ie_edge'];*/ } /** * Implements hook_preprocess_page() for page.html.twig. */ function vue_js_preprocess_page(array &$variables) { $route = \Drupal::routeMatch()->getRouteName(); if (stripos($route, 'layout_builder.') !== FALSE) { $variables['#attached']['library'][] = 'vue_js/layout-builder-prettier'; } else { // Not a Layout builder route, so let's mark to hide contextual links $variables['attributes']['class'][] = 'hide-contextual-links'; } } /** * Implements hook_theme_suggestions_page_alter(). */ function vue_js_theme_suggestions_page_alter(array &$suggestions, array $variables) { } /** * Implements hook_theme_suggestions_node_alter(). */ function vue_js_theme_suggestions_node_alter(array &$suggestions, array $variables) { /*$node = $variables['elements']['#node']; if ($variables['elements']['#view_mode'] == "full") { }*/ } /** * Implements hook_preprocess_HOOK() for Block document templates. */ function vue_js_preprocess_block(array &$variables) { if (isset($variables['content']['#block_content'])) { /* @var $block \Drupal\block_content\Entity\BlockContent */ $block = $variables['content']['#block_content']; $type = $block->bundle(); $variables['block'] = $variables['content']['#block_content']; $function = __FUNCTION__ . "_{$type}"; if (function_exists($function)) { $function($variables); } } } /** * Implements hook_theme_suggestions_field_alter(). */ function vue_js_theme_suggestions_field_alter(array &$suggestions, array $variables) { /*$element = $variables['element']; $suggestions[] = 'field__' . $element['#view_mode']; $suggestions[] = 'field__' . $element['#view_mode'] . '__' . $element['#field_name'];*/ } /** * Implements hook_theme_suggestions_field_alter(). */ function vue_js_theme_suggestions_fieldset_alter(array &$suggestions, array $variables) { /*$element = $variables['element']; if (isset($element['#attributes']['class']) && in_array('form-composite', $element['#attributes']['class'])) { $suggestions[] = 'fieldset__form_composite'; }*/ } /** * Implements hook_preprocess_node(). */ function vue_js_preprocess_node(array &$variables) { /* @var \Drupal\node\Entity\Node $node */ $node = $variables['node']; $type = $node->bundle(); $view_mode = $variables['view_mode'] ?? NULL; $variables['attributes']['class'][] = 'node'; $variables['attributes']['class'][] = 'node__' . Html::cleanCssIdentifier($type); if ($view_mode) { $variables['attributes']['class'][] = 'node__' . Html::cleanCssIdentifier($type) . '__view_mode_' . Html::cleanCssIdentifier($view_mode); } $function = __FUNCTION__ . "_{$type}"; if (function_exists($function)) { $function($variables); } } /** * Implements hook_preprocess_paragraph(). */ function vue_js_preprocess_paragraph(array &$variables) { /* @var \Drupal\paragraphs\Entity\ParagraphsType $paragraph_type */ $paragraph_type = $variables['elements']['#paragraph']->getParagraphType(); $function = __FUNCTION__ . "_{$paragraph_type->id()}"; if (function_exists($function)) { $function($variables); } } function nazarene_org_preprocess_media(array &$variables) { $bundle = $variables['media']->bundle(); $function = __FUNCTION__ . "_{$bundle}"; if (function_exists($function)) { $function($variables); } } /** * Implements hook_theme_suggestions_views_view_alter(). */ function vue_js_theme_suggestions_views_view_alter(array &$suggestions, array $variables) { } /** * Implements hook_preprocess_form(). */ function vue_js_preprocess_form(array &$variables) { //$variables['attributes']['novalidate'] = 'novalidate'; } /** * Implements hook_preprocess_select(). */ function vue_js_preprocess_select(array &$variables) { //$variables['attributes']['class'][] = 'select-chosen'; } /** * Implements hook_preprocess_field(). */ function vue_js_preprocess_field(array &$variables, $hook) { /*switch ($variables['element']['#field_name']) { }*/ } /** * Implements hook_preprocess_details(). */ function vue_js_preprocess_details(array &$variables) { /*$variables['attributes']['class'][] = 'details'; $variables['summary_attributes']['class'] = 'summary';*/ } /** * Implements hook_theme_suggestions_details_alter(). */ function vue_js_theme_suggestions_details_alter(array &$suggestions, array $variables) { } /** * Implements hook_preprocess_menu_local_task(). */ function vue_js_preprocess_menu_local_task(array &$variables) { //$variables['element']['#link']['url']->setOption('attributes', ['class'=>'rounded']); }