5 * Functions to support theming in the {{ machine_name }} theme.
9 * Implements hook_preprocess_HOOK() for html.html.twig.
11 function {{ machine_name }}_preprocess_html(array &$variables) {
12 /* Add class to html tag */
13 //$variables['html_attributes']->addClass('no-js');
15 // Don't display the site name twice on the front page (and potentially others)
16 /*if (isset($variables['head_title_array']['title']) && isset($variables['head_title_array']['name']) && ($variables['head_title_array']['title'] == $variables['head_title_array']['name'])) {
17 $variables['head_title'] = $variables['head_title_array']['name'];
22 * Implements hook_page_attachments_alter().
24 function {{ machine_name }}_page_attachments_alter(array &$page) {
25 // Tell IE to use latest rendering engine (not to use compatibility mode).
27 '#type' => 'html_tag',
30 'http-equiv' => 'X-UA-Compatible',
31 'content' => 'IE=edge',
34 $page['#attached']['html_head'][] = [$ie_edge, 'ie_edge'];*/
38 * Implements hook_preprocess_page() for page.html.twig.
40 function {{ machine_name }}_preprocess_page(array &$variables) {
45 * Implements hook_theme_suggestions_page_alter().
47 function {{ machine_name }}_theme_suggestions_page_alter(array &$suggestions, array $variables) {
52 * Implements hook_theme_suggestions_node_alter().
54 function {{ machine_name }}_theme_suggestions_node_alter(array &$suggestions, array $variables) {
55 /*$node = $variables['elements']['#node'];
57 if ($variables['elements']['#view_mode'] == "full") {
63 * Implements hook_preprocess_HOOK() for Block document templates.
65 function {{ machine_name }}_preprocess_block(array &$variables) {
70 * Implements hook_theme_suggestions_field_alter().
72 function {{ machine_name }}_theme_suggestions_field_alter(array &$suggestions, array $variables) {
73 /*$element = $variables['element'];
74 $suggestions[] = 'field__' . $element['#view_mode'];
75 $suggestions[] = 'field__' . $element['#view_mode'] . '__' . $element['#field_name'];*/
79 * Implements hook_theme_suggestions_field_alter().
81 function {{ machine_name }}_theme_suggestions_fieldset_alter(array &$suggestions, array $variables) {
82 /*$element = $variables['element'];
83 if (isset($element['#attributes']['class']) && in_array('form-composite', $element['#attributes']['class'])) {
84 $suggestions[] = 'fieldset__form_composite';
89 * Implements hook_preprocess_node().
91 function {{ machine_name }}_preprocess_node(array &$variables) {
92 // Default to turning off byline/submitted.
93 //$variables['display_submitted'] = FALSE;
97 * Implements hook_theme_suggestions_views_view_alter().
99 function {{ machine_name }}_theme_suggestions_views_view_alter(array &$suggestions, array $variables) {
104 * Implements hook_preprocess_form().
106 function {{ machine_name }}_preprocess_form(array &$variables) {
107 //$variables['attributes']['novalidate'] = 'novalidate';
111 * Implements hook_preprocess_select().
113 function {{ machine_name }}_preprocess_select(array &$variables) {
114 //$variables['attributes']['class'][] = 'select-chosen';
118 * Implements hook_preprocess_field().
120 function {{ machine_name }}_preprocess_field(array &$variables, $hook) {
121 /*switch ($variables['element']['#field_name']) {
126 * Implements hook_preprocess_details().
128 function {{ machine_name }}_preprocess_details(array &$variables) {
129 /*$variables['attributes']['class'][] = 'details';
130 $variables['summary_attributes']['class'] = 'summary';*/
134 * Implements hook_theme_suggestions_details_alter().
136 function {{ machine_name }}_theme_suggestions_details_alter(array &$suggestions, array $variables) {
141 * Implements hook_preprocess_menu_local_task().
143 function {{ machine_name }}_preprocess_menu_local_task(array &$variables) {
144 //$variables['element']['#link']['url']->setOption('attributes', ['class'=>'rounded']);