test Drupal site working on Koality Theme Builder
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
4.0 KiB

4 years ago
  1. <?php
  2. /**
  3. * @file
  4. * Functions to support theming in the {{ machine_name }} theme.
  5. */
  6. /**
  7. * Implements hook_preprocess_HOOK() for html.html.twig.
  8. */
  9. function {{ machine_name }}_preprocess_html(array &$variables) {
  10. /* Add class to html tag */
  11. //$variables['html_attributes']->addClass('no-js');
  12. // Don't display the site name twice on the front page (and potentially others)
  13. /*if (isset($variables['head_title_array']['title']) && isset($variables['head_title_array']['name']) && ($variables['head_title_array']['title'] == $variables['head_title_array']['name'])) {
  14. $variables['head_title'] = $variables['head_title_array']['name'];
  15. }*/
  16. }
  17. /**
  18. * Implements hook_page_attachments_alter().
  19. */
  20. function {{ machine_name }}_page_attachments_alter(array &$page) {
  21. // Tell IE to use latest rendering engine (not to use compatibility mode).
  22. /*$ie_edge = [
  23. '#type' => 'html_tag',
  24. '#tag' => 'meta',
  25. '#attributes' => [
  26. 'http-equiv' => 'X-UA-Compatible',
  27. 'content' => 'IE=edge',
  28. ],
  29. ];
  30. $page['#attached']['html_head'][] = [$ie_edge, 'ie_edge'];*/
  31. }
  32. /**
  33. * Implements hook_preprocess_page() for page.html.twig.
  34. */
  35. function {{ machine_name }}_preprocess_page(array &$variables) {
  36. }
  37. /**
  38. * Implements hook_theme_suggestions_page_alter().
  39. */
  40. function {{ machine_name }}_theme_suggestions_page_alter(array &$suggestions, array $variables) {
  41. }
  42. /**
  43. * Implements hook_theme_suggestions_node_alter().
  44. */
  45. function {{ machine_name }}_theme_suggestions_node_alter(array &$suggestions, array $variables) {
  46. /*$node = $variables['elements']['#node'];
  47. if ($variables['elements']['#view_mode'] == "full") {
  48. }*/
  49. }
  50. /**
  51. * Implements hook_preprocess_HOOK() for Block document templates.
  52. */
  53. function {{ machine_name }}_preprocess_block(array &$variables) {
  54. }
  55. /**
  56. * Implements hook_theme_suggestions_field_alter().
  57. */
  58. function {{ machine_name }}_theme_suggestions_field_alter(array &$suggestions, array $variables) {
  59. /*$element = $variables['element'];
  60. $suggestions[] = 'field__' . $element['#view_mode'];
  61. $suggestions[] = 'field__' . $element['#view_mode'] . '__' . $element['#field_name'];*/
  62. }
  63. /**
  64. * Implements hook_theme_suggestions_field_alter().
  65. */
  66. function {{ machine_name }}_theme_suggestions_fieldset_alter(array &$suggestions, array $variables) {
  67. /*$element = $variables['element'];
  68. if (isset($element['#attributes']['class']) && in_array('form-composite', $element['#attributes']['class'])) {
  69. $suggestions[] = 'fieldset__form_composite';
  70. }*/
  71. }
  72. /**
  73. * Implements hook_preprocess_node().
  74. */
  75. function {{ machine_name }}_preprocess_node(array &$variables) {
  76. // Default to turning off byline/submitted.
  77. //$variables['display_submitted'] = FALSE;
  78. }
  79. /**
  80. * Implements hook_theme_suggestions_views_view_alter().
  81. */
  82. function {{ machine_name }}_theme_suggestions_views_view_alter(array &$suggestions, array $variables) {
  83. }
  84. /**
  85. * Implements hook_preprocess_form().
  86. */
  87. function {{ machine_name }}_preprocess_form(array &$variables) {
  88. //$variables['attributes']['novalidate'] = 'novalidate';
  89. }
  90. /**
  91. * Implements hook_preprocess_select().
  92. */
  93. function {{ machine_name }}_preprocess_select(array &$variables) {
  94. //$variables['attributes']['class'][] = 'select-chosen';
  95. }
  96. /**
  97. * Implements hook_preprocess_field().
  98. */
  99. function {{ machine_name }}_preprocess_field(array &$variables, $hook) {
  100. /*switch ($variables['element']['#field_name']) {
  101. }*/
  102. }
  103. /**
  104. * Implements hook_preprocess_details().
  105. */
  106. function {{ machine_name }}_preprocess_details(array &$variables) {
  107. /*$variables['attributes']['class'][] = 'details';
  108. $variables['summary_attributes']['class'] = 'summary';*/
  109. }
  110. /**
  111. * Implements hook_theme_suggestions_details_alter().
  112. */
  113. function {{ machine_name }}_theme_suggestions_details_alter(array &$suggestions, array $variables) {
  114. }
  115. /**
  116. * Implements hook_preprocess_menu_local_task().
  117. */
  118. function {{ machine_name }}_preprocess_menu_local_task(array &$variables) {
  119. //$variables['element']['#link']['url']->setOption('attributes', ['class'=>'rounded']);
  120. }