<?php

/**
 * @file
 * Functions to support theming in the {{ machine_name }} theme.
 */

/**
 * Implements hook_preprocess_HOOK() for html.html.twig.
 */
function {{ machine_name }}_preprocess_html(array &$variables) {
  /* Add class to html tag */
  //$variables['html_attributes']->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 {{ machine_name }}_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 {{ machine_name }}_preprocess_page(array &$variables) {

}

/**
 * Implements hook_theme_suggestions_page_alter().
 */
function {{ machine_name }}_theme_suggestions_page_alter(array &$suggestions, array $variables) {

}

/**
 * Implements hook_theme_suggestions_node_alter().
 */
function {{ machine_name }}_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 {{ machine_name }}_preprocess_block(array &$variables) {

}

/**
 * Implements hook_theme_suggestions_field_alter().
 */
function {{ machine_name }}_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 {{ machine_name }}_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 {{ machine_name }}_preprocess_node(array &$variables) {
  // Default to turning off byline/submitted.
  //$variables['display_submitted'] = FALSE;
}

/**
 * Implements hook_theme_suggestions_views_view_alter().
 */
function {{ machine_name }}_theme_suggestions_views_view_alter(array &$suggestions, array $variables) {

}

/**
 * Implements hook_preprocess_form().
 */
function {{ machine_name }}_preprocess_form(array &$variables) {
  //$variables['attributes']['novalidate'] = 'novalidate';
}

/**
 * Implements hook_preprocess_select().
 */
function {{ machine_name }}_preprocess_select(array &$variables) {
  //$variables['attributes']['class'][] = 'select-chosen';
}

/**
 * Implements hook_preprocess_field().
 */
function {{ machine_name }}_preprocess_field(array &$variables, $hook) {
  /*switch ($variables['element']['#field_name']) {
  }*/
}

/**
 * Implements hook_preprocess_details().
 */
function {{ machine_name }}_preprocess_details(array &$variables) {
  /*$variables['attributes']['class'][] = 'details';
  $variables['summary_attributes']['class'] = 'summary';*/
}

/**
 * Implements hook_theme_suggestions_details_alter().
 */
function {{ machine_name }}_theme_suggestions_details_alter(array &$suggestions, array $variables) {

}

/**
 * Implements hook_preprocess_menu_local_task().
 */
function {{ machine_name }}_preprocess_menu_local_task(array &$variables) {
  //$variables['element']['#link']['url']->setOption('attributes', ['class'=>'rounded']);
}
