<commit_before><?php

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

use Drupal\Component\Utility\SafeMarkup;
use Drupal\node\Entity\Node;

/**
 * Implements hook_preprocess_HOOK() for HTML document templates.
 */
function {{ machine_name }}_preprocess_html(&$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) {
    // Disabling browser zoom on mobile devices.
    /*foreach ($page['#attached']['html_head'] as &$meta_arr) {
        if (array_search('viewport', $meta_arr)) {
          $meta_arr[0]['#attributes']['content'] .= ', maximum-scale=1.0, user-scalable=0';
        }
    }*/


    // Tell IE to use latest rendering engine (not to use compatibility mode).
    /*$ie_edge = array(
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#attributes' => array(
        'http-equiv' => 'X-UA-Compatible',
        'content' => 'IE=edge',
        ),
    );
    $page['#attached']['html_head'][] = [$ie_edge, 'ie_edge'];*/
}

/**
* Implements hook_preprocess_page() for PAGE document templates.
*/
function {{ machine_name }}_preprocess_page(&$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(&$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(&$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(&$variables) {
    //$variables['attributes']['novalidate'] = 'novalidate';
}

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

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

/**
* Implements hook_preprocess_details().
*/
function {{  machine_name }}_preprocess_details(&$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(&$variables) {
    //$variables['element']['#link']['url']->setOption('attributes', array('class'=>'rounded'));
}
<commit_msg>Coding standards and cleanup for theme.twig<commit_after><?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) {
  // Disabling browser zoom on mobile devices.
  /*foreach ($page['#attached']['html_head'] as &$meta_arr) {
    if (array_search('viewport', $meta_arr)) {
      $meta_arr[0]['#attributes']['content'] .= ', maximum-scale=1.0, user-scalable=0';
    }
  }*/


  // 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']);
}
{'fraction_non_alphanumeric': 0.18979013045944412, 'fraction_numerical': 0.0009075439591605219, 'mean_word_length': 5.239207360226469, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3190583', 'n_tokens_mistral': 2846, 'n_tokens_neox': 2773, 'n_words': 476}