<?php

/**
 * @file
 * Functions to support theming page layout in the Toc Master theme.
 */

use Drupal\node\NodeInterface;

/**
 * Implements hook_preprocess_HOOK().
 */
function toc_lnr_preprocess_page(&$vars) {
  $vars['scrl_top_side'] = "right scrl-center-mobile";
  $vars['scrl_top_link'] = "<i class='fas fa-chevron-up'></i><br><span class='scrl-top-text-lower'>Back to top</span>";
  if ($vars['is_front']) {
    $vars['main_classes'] = 'mb-4';
  }
  $node = \Drupal::routeMatch()->getParameter('node');

  // Proceed only if we are on a node page that is an instance of NodeInterface.
  if ($node instanceof NodeInterface && $node->bundle() == 'destination') {
    $vars['header_class'] = empty($vars['header_class']) ? 'header-static no-minify' : $vars['header_class'] . ' header-static no-minify';
  }
}
