Loading core/modules/system/tests/themes/test_theme/test_theme.theme +15 −3 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ use Drupal\twig_theme_test\TwigThemeTestUtils; /** * Implements THEME_preprocess_twig_theme_test_php_variables(). * Implements hook_preprocess_HOOK() for twig_theme_test_php_variables. */ function test_theme_preprocess_twig_theme_test_php_variables(&$variables): void { $variables['php_values'] = TwigThemeTestUtils::phpValues(); Loading @@ -36,6 +36,8 @@ function test_theme_library_info_alter(&$libraries, $extension): void { } /** * Implements hook_theme_test_alter_alter(). * * Tests a theme implementing an alter hook. * * The confusing function name here is due to this being an implementation of Loading Loading @@ -90,15 +92,17 @@ function test_theme_theme_registry_alter(&$registry): void { } /** * Tests a theme overriding a default hook with a suggestion. * Implements hook_preprocess_HOOK() for theme_test_preprocess_suggestions. * * Implements hook_preprocess_HOOK(). * Tests a theme overriding a default hook with a suggestion. */ function test_theme_preprocess_theme_test_preprocess_suggestions(&$variables): void { $variables['foo'] = 'Theme hook implementor=test_theme_preprocess_theme_test_preprocess_suggestions().'; } /** * Implements hook_preprocess_HOOK(). * * Tests a theme overriding a default hook with a suggestion. */ function test_theme_preprocess_theme_test_preprocess_suggestions__suggestion(&$variables): void { Loading @@ -106,6 +110,8 @@ function test_theme_preprocess_theme_test_preprocess_suggestions__suggestion(&$v } /** * Implements hook_preprocess_HOOK(). * * Tests a theme overriding a default hook with a suggestion. */ function test_theme_preprocess_theme_test_preprocess_suggestions__kitten(&$variables): void { Loading @@ -113,6 +119,8 @@ function test_theme_preprocess_theme_test_preprocess_suggestions__kitten(&$varia } /** * Implements hook_preprocess_HOOK(). * * Tests a theme overriding a default hook with a suggestion. */ function test_theme_preprocess_theme_test_preprocess_suggestions__kitten__flamingo(&$variables): void { Loading @@ -120,6 +128,8 @@ function test_theme_preprocess_theme_test_preprocess_suggestions__kitten__flamin } /** * Implements hook_preprocess_HOOK(). * * Tests a preprocess function with suggestions. */ function test_theme_preprocess_theme_test_preprocess_suggestions__kitten__meerkat__tarsier__moose(&$variables): void { Loading @@ -127,6 +137,8 @@ function test_theme_preprocess_theme_test_preprocess_suggestions__kitten__meerka } /** * Implements hook_preprocess_HOOK() for theme_test_theme_class. * * Tests that a class can be loaded within a .theme file. */ function test_theme_preprocess_theme_test_theme_class(&$variables): void { Loading core/profiles/demo_umami/themes/umami/umami.theme +11 −11 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ use Drupal\Core\Render\Element; /** * Implements hook_preprocess_HOOK() for HTML document templates. * Implements hook_preprocess_HOOK() for html. * * Adds body classes if certain regions have content. */ Loading @@ -29,7 +29,7 @@ function umami_preprocess_html(&$variables): void { } /** * Implements hook_preprocess_field(). * Implements hook_preprocess_HOOK() for field. */ function umami_preprocess_field(&$variables, $hook): void { $element = $variables['element']; Loading @@ -49,7 +49,7 @@ function umami_preprocess_field(&$variables, $hook): void { } /** * Implements hook_preprocess_block(). * Implements hook_preprocess_HOOK() for block. */ function umami_preprocess_block(&$variables): void { $variables['title_attributes']['class'][] = 'block__title'; Loading @@ -70,7 +70,7 @@ function umami_theme_suggestions_block_alter(array &$suggestions, array $variabl } /** * Implements hook_umami_preprocess_block__bundle__banner_block(). * Implements hook_preprocess_HOOK() for block--bundle--banner-block. */ function umami_preprocess_block__bundle__banner_block(&$variables): void { if (isset($variables['content']['field_content_link'])) { Loading @@ -83,7 +83,7 @@ function umami_preprocess_block__bundle__banner_block(&$variables): void { } /** * Implements hook_umami_preprocess_block__bundle__footer_promo_block(). * Implements hook_preprocess_HOOK() for block bundle footer promo. */ function umami_preprocess_block__bundle__footer_promo_block(&$variables): void { if (isset($variables['content']['field_content_link'])) { Loading @@ -94,7 +94,7 @@ function umami_preprocess_block__bundle__footer_promo_block(&$variables): void { } /** * Implements hook_preprocess_breadcrumb(). * Implements hook_preprocess_HOOK() for breadcrumb. */ function umami_preprocess_breadcrumb(&$variables): void { // We are creating a variable for the Current Page Title, to allow us to print Loading @@ -119,21 +119,21 @@ function umami_preprocess_breadcrumb(&$variables): void { } /** * Implements hook_preprocess_menu_local_task(). * Implements hook_preprocess_HOOK() for menu-local-task. */ function umami_preprocess_menu_local_task(&$variables): void { $variables['link']['#options']['attributes']['class'][] = 'tabs__link'; } /** * Implements hook_form_FORM_ID_alter(). * Implements hook_form_FORM_ID_alter() for search_block_form. */ function umami_form_search_block_form_alter(&$form, FormStateInterface $form_state): void { $form['keys']['#attributes']['placeholder'] = t('Search by keyword, ingredient, dish'); } /** * Implements hook_preprocess_links__media_library_menu(). * Implements hook_preprocess_HOOK() for links--media-library-menu. * * This targets the menu of available media types in the media library's modal * dialog. Loading Loading @@ -161,7 +161,7 @@ function umami_form_alter(array &$form, FormStateInterface $form_state, $form_id } /** * Implements hook_preprocess_image_widget(). * Implements hook_preprocess_HOOK() for image-widget. * * @todo Revisit in https://drupal.org/node/3117430 */ Loading @@ -173,7 +173,7 @@ function umami_preprocess_image_widget(&$variables): void { } /** * Implements template_preprocess_links(). * Implements hook_preprocess_HOOK() for links. * * This makes it so array keys of #links items are added as a class. This * functionality was removed in Drupal 8.1, but still necessary in some Loading core/themes/claro/claro.theme +28 −24 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ function claro_preprocess_menu_local_task__views_ui(&$variables): void { } /** * Implements template_preprocess_HOOK() for node_add_list. * Implements hook_preprocess_HOOK() for node_add_list. * * Makes node_add_list variables compatible with entity_add_list. */ Loading Loading @@ -161,7 +161,7 @@ function claro_preprocess_node_add_list(&$variables): void { } /** * Implements template_preprocess_HOOK() for block_content_add_list. * Implements hook_preprocess_HOOK() for block_content_add_list. * * Makes block_content_add_list variables compatible with entity_add_list. * Loading Loading @@ -199,7 +199,7 @@ function claro_preprocess_block_content_add_list(&$variables): void { } /** * Implements template_preprocess_HOOK() for entity_add_list. * Implements hook_preprocess_HOOK() for entity_add_list. */ function claro_preprocess_entity_add_list(&$variables): void { // Remove description if empty. Loading @@ -225,7 +225,7 @@ function claro_preprocess_block(&$variables): void { } /** * Implements template_preprocess_HOOK() for admin_block. * Implements hook_preprocess_HOOK() for admin_block. */ function claro_preprocess_admin_block(&$variables): void { if (!empty($variables['block']['content'])) { Loading @@ -234,7 +234,7 @@ function claro_preprocess_admin_block(&$variables): void { } /** * Implements template_preprocess_HOOK() for admin_block. * Implements hook_preprocess_HOOK() for admin_block_content. */ function claro_preprocess_admin_block_content(&$variables): void { foreach ($variables['content'] as &$item) { Loading Loading @@ -851,7 +851,7 @@ function claro_preprocess_form_element(&$variables): void { } /** * Implements template_preprocess_HOOK() for input. * Implements hook_preprocess_HOOK() for input. */ function claro_preprocess_input(&$variables): void { if ( Loading Loading @@ -898,7 +898,7 @@ function claro_preprocess_input(&$variables): void { } /** * Implements template_preprocess_HOOK() for select. * Implements hook_preprocess_HOOK() for select. */ function claro_preprocess_select(&$variables): void { if (!empty($variables['element']['#title_display']) && $variables['element']['#title_display'] === 'attribute' && !empty((string) $variables['element']['#title'])) { Loading @@ -916,7 +916,7 @@ function claro_preprocess_select(&$variables): void { } /** * Implements template_preprocess_HOOK() for datetime_wrapper. * Implements hook_preprocess_HOOK() for datetime_wrapper. */ function claro_preprocess_datetime_wrapper(&$variables): void { if (!empty($variables['element']['#errors'])) { Loading @@ -933,7 +933,7 @@ function claro_preprocess_datetime_wrapper(&$variables): void { } /** * Implements template_preprocess_HOOK() for fieldset. * Implements hook_preprocess_HOOK() for fieldset. */ function claro_preprocess_fieldset(&$variables): void { $element = $variables['element']; Loading Loading @@ -1032,14 +1032,14 @@ function claro_preprocess_form_element__password(&$variables): void { } /** * Implements template_preprocess_HOOK() for filter_tips. * Implements hook_preprocess_HOOK() for filter_tips. */ function claro_preprocess_filter_tips(&$variables): void { $variables['#attached']['library'][] = 'filter/drupal.filter'; } /** * Implements template_preprocess_HOOK() for table. * Implements hook_preprocess_HOOK() for table. */ function claro_preprocess_table(&$variables): void { // Adding table sort indicator CSS class for inactive sort link. Loading Loading @@ -1083,14 +1083,14 @@ function claro_preprocess_table(&$variables): void { } /** * Implements template_preprocess_HOOK() for field_ui_table. * Implements hook_preprocess_HOOK() for field_ui_table. */ function claro_preprocess_field_ui_table(&$variables): void { claro_preprocess_table($variables); } /** * Implements template_preprocess_HOOK() for views_view_table. * Implements hook_preprocess_HOOK() for views_view_table. * * @todo Revisit after https://www.drupal.org/node/3025726 or * https://www.drupal.org/node/1973418 is in. Loading Loading @@ -1355,7 +1355,7 @@ function _claro_preprocess_file_and_image_widget(array &$variables): void { } /** * Implements hook_preprocess_views_view_fields(). * Implements hook_preprocess_HOOK() for views_view_fields__media_library. * * This targets each rendered media item in the grid display of the media * library's modal dialog. Loading @@ -1369,7 +1369,7 @@ function claro_preprocess_views_view_fields__media_library(array &$variables): v } /** * Implements hook_form_BASE_FORM_ID_alter(). * Implements hook_form_BASE_FORM_ID_alter() for media_library_add_form. */ function claro_form_media_library_add_form_alter(array &$form, FormStateInterface $form_state): void { $form['#attributes']['class'][] = 'media-library-add-form'; Loading @@ -1390,7 +1390,7 @@ function claro_form_media_library_add_form_alter(array &$form, FormStateInterfac } /** * Implements hook_form_FORM_ID_alter(). * Implements hook_form_FORM_ID_alter() for media_library_add_form_upload. */ function claro_form_media_library_add_form_upload_alter(array &$form, FormStateInterface $form_state): void { $form['#attributes']['class'][] = 'media-library-add-form--upload'; Loading @@ -1405,7 +1405,7 @@ function claro_form_media_library_add_form_upload_alter(array &$form, FormStateI } /** * Implements hook_form_FORM_ID_alter(). * Implements hook_form_FORM_ID_alter() for media_library_add_form_oembed. */ function claro_form_media_library_add_form_oembed_alter(array &$form, FormStateInterface $form_state): void { $form['#attributes']['class'][] = 'media-library-add-form--oembed'; Loading @@ -1420,7 +1420,7 @@ function claro_form_media_library_add_form_oembed_alter(array &$form, FormStateI } /** * Implements hook_preprocess_item_list__media_library_add_form_media_list(). * Implements hook_preprocess_HOOK() for item_list__media_library_add_form_media_list. * * This targets each new, unsaved media item added to the media library, before * they are saved. Loading @@ -1447,7 +1447,7 @@ function claro_preprocess_item_list__media_library_add_form_media_list(array &$v } /** * Implements hook_preprocess_media_library_item__widget(). * Implements hook_preprocess_HOOK() for media_library_item__widget. * * This targets each media item selected in an entity reference field. */ Loading @@ -1457,7 +1457,7 @@ function claro_preprocess_media_library_item__widget(array &$variables): void { } /** * Implements hook_preprocess_media_library_item__small(). * Implements hook_preprocess_HOOK() for media_library_item__small. * * This targets each pre-selected media item selected when adding new media in * the modal media library dialog. Loading @@ -1467,6 +1467,8 @@ function claro_preprocess_media_library_item__small(array &$variables): void { } /** * Implements hook_preprocess_HOOK() for fieldset__media_library_widget. * * @todo Remove this when https://www.drupal.org/project/drupal/issues/2999549 * lands. * Loading Loading @@ -1538,7 +1540,7 @@ function claro_views_pre_render(ViewExecutable $view): void { } /** * Implements hook_preprocess_links__media_library_menu(). * Implements hook_preprocess_HOOK() for links__media_library_menu. * * This targets the menu of available media types in the media library's modal * dialog. Loading @@ -1555,7 +1557,9 @@ function claro_preprocess_links__media_library_menu(array &$variables): void { } /** * Implements hook_form_FORM_ID_alter() for the Views UI rearrange filter form. * Implements hook_preprocess_HOOK() for views_ui_rearrange_filter_form. * * Views UI rearrange filter form. */ function claro_preprocess_views_ui_rearrange_filter_form(array &$variables): void { foreach ($variables['table']['#rows'] as &$row) { Loading Loading @@ -1665,7 +1669,7 @@ function claro_form_views_ui_add_handler_form_alter(array &$form, FormStateInter } /** * Implements hook_preprocess_toolbar(). * Implements hook_preprocess_HOOK() for toolbar. * * This is also called by system_preprocess_toolbar() in instances where Claro * is the admin theme but not the active theme. Loading Loading @@ -1737,7 +1741,7 @@ function claro_form_user_admin_permissions_alter(&$form, FormStateInterface $for } /** * Implements hook_form_FORM_ID_alter(). * Implements hook_form_FORM_ID_alter() for node_preview_form_select. */ function claro_form_node_preview_form_select_alter(array &$form, FormStateInterface $form_state): void { if (isset($form['backlink'])) { Loading core/themes/olivero/olivero.theme +23 −23 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ use Drupal\user\UserInterface; /** * Implements hook_preprocess_HOOK() for page title templates. * Implements hook_preprocess_HOOK() for page-title. */ function olivero_preprocess_page_title(&$variables): void { // Since the title and the shortcut link are both block level elements, Loading Loading @@ -43,7 +43,7 @@ function olivero_preprocess_page_title(&$variables): void { } /** * Implements hook_preprocess_HOOK() for maintenance-page.html.twig. * Implements hook_preprocess_HOOK() for maintenance-page. */ function olivero_preprocess_maintenance_page(&$variables): void { // By default, site_name is set to Drupal if no db connection is available Loading @@ -59,7 +59,7 @@ function olivero_preprocess_maintenance_page(&$variables): void { } /** * Implements hook_preprocess_HOOK() for node.html.twig. * Implements hook_preprocess_HOOK() for node. */ function olivero_preprocess_node(&$variables): void { // Remove the "Add new comment" link on teasers or when the comment form is Loading @@ -82,7 +82,7 @@ function olivero_preprocess_node(&$variables): void { } /** * Implements hook_preprocess_HOOK() for block.html.twig. * Implements hook_preprocess_HOOK() for block. */ function olivero_preprocess_block(&$variables): void { if (!empty($variables['elements']['#id'])) { Loading Loading @@ -136,7 +136,7 @@ function olivero_theme_suggestions_menu_alter(&$suggestions, array $variables): } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for menu. */ function olivero_preprocess_menu(&$variables): void { if (isset($variables['attributes']['region'])) { Loading Loading @@ -205,7 +205,7 @@ function olivero_theme_suggestions_block_alter(&$suggestions, array $variables): } /** * Implements hook_preprocess_HOOK() for menu-local-tasks templates. * Implements hook_preprocess_HOOK() for menu-local-tasks. */ function olivero_preprocess_menu_local_tasks(&$variables): void { foreach (Element::children($variables['primary']) as $key) { Loading @@ -217,7 +217,7 @@ function olivero_preprocess_menu_local_tasks(&$variables): void { } /** * Implements hook_preprocess_form_element(). * Implements hook_preprocess_HOOK() for form-element. */ function olivero_preprocess_form_element(&$variables): void { if (in_array($variables['element']['#type'] ?? FALSE, ['checkbox', 'radio'], TRUE)) { Loading @@ -234,14 +234,14 @@ function olivero_preprocess_form_element(&$variables): void { } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for form-element-label. */ function olivero_preprocess_form_element_label(&$variables): void { $variables['attributes']['class'][] = 'form-item__label'; } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for input. */ function olivero_preprocess_input(&$variables): void { if ( Loading Loading @@ -291,7 +291,7 @@ function olivero_preprocess_input(&$variables): void { } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for textarea. */ function olivero_preprocess_textarea(&$variables): void { $variables['attributes']['class'][] = 'form-element'; Loading @@ -300,7 +300,7 @@ function olivero_preprocess_textarea(&$variables): void { } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for select. */ function olivero_preprocess_select(&$variables): void { $variables['attributes']['class'][] = 'form-element'; Loading @@ -310,21 +310,21 @@ function olivero_preprocess_select(&$variables): void { } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for checkboxes. */ function olivero_preprocess_checkboxes(&$variables): void { $variables['attributes']['class'][] = 'form-boolean-group'; } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for radios. */ function olivero_preprocess_radios(&$variables): void { $variables['attributes']['class'][] = 'form-boolean-group'; } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for field. */ function olivero_preprocess_field(&$variables): void { $rich_field_types = ['text_with_summary', 'text', 'text_long']; Loading @@ -340,7 +340,7 @@ function olivero_preprocess_field(&$variables): void { } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for field-multiple-value-form. */ function olivero_preprocess_field_multiple_value_form(&$variables): void { // Make disabled available for the template. Loading Loading @@ -394,7 +394,7 @@ function olivero_preprocess_field_multiple_value_form(&$variables): void { } /** * Implements hook_preprocess_HOOK() for menu-local-task templates. * Implements hook_preprocess_HOOK() for menu-local-task. */ function olivero_preprocess_menu_local_task(&$variables): void { $variables['link']['#options']['attributes']['class'][] = 'tabs__link'; Loading @@ -413,7 +413,7 @@ function olivero_preprocess_menu_local_task(&$variables): void { } /** * Implements template_preprocess_HOOK() for fieldset. * Implements hook_preprocess_HOOK() for fieldset. */ function olivero_preprocess_fieldset(&$variables): void { $element = $variables['element']; Loading Loading @@ -469,7 +469,7 @@ function olivero_preprocess_filter_caption(&$variables): void { } /** * Implements hook_form_FORM_ID_alter(). * Implements hook_form_FORM_ID_alter() for node_preview_form_select. */ function olivero_form_node_preview_form_select_alter(&$form, FormStateInterface $form_state, $form_id): void { $form['backlink']['#options']['attributes']['class'][] = 'button'; Loading @@ -480,7 +480,7 @@ function olivero_form_node_preview_form_select_alter(&$form, FormStateInterface } /** * Implements hook_preprocess_HOOK() for comment.html.twig. * Implements hook_preprocess_HOOK() for comment. */ function olivero_preprocess_comment(&$variables): void { // Getting the node creation time stamp from the comment object. Loading @@ -490,7 +490,7 @@ function olivero_preprocess_comment(&$variables): void { } /** * Implements hook_preprocess_HOOK() for field--comment.html.twig. * Implements hook_preprocess_HOOK() for field--comment. */ function olivero_preprocess_field__comment(&$variables): void { // Add a comment_count. Loading Loading @@ -524,7 +524,7 @@ function olivero_element_info_alter(&$info): void { } /** * Implements template_preprocess_text_format_wrapper(). * Implements hook_preprocess_HOOK() for text-format-wrapper. * * @todo Remove when https://www.drupal.org/node/3016343 is fixed. */ Loading Loading @@ -588,14 +588,14 @@ function olivero_preprocess_table(&$variables): void { } /** * Implements hook_preprocess_HOOK() for views-view-table templates. * Implements hook_preprocess_HOOK() for views-view-table. */ function olivero_preprocess_views_view_table(&$variables): void { $variables['#attached']['library'][] = 'olivero/olivero.table'; } /** * Implements hook_form_views_exposed_form_alter(). * Implements hook_form_FORM_ID_alter() for views_exposed_form. */ function olivero_form_views_exposed_form_alter(&$form): void { $form['#attributes']['class'][] = 'form--inline'; Loading Loading
core/modules/system/tests/themes/test_theme/test_theme.theme +15 −3 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ use Drupal\twig_theme_test\TwigThemeTestUtils; /** * Implements THEME_preprocess_twig_theme_test_php_variables(). * Implements hook_preprocess_HOOK() for twig_theme_test_php_variables. */ function test_theme_preprocess_twig_theme_test_php_variables(&$variables): void { $variables['php_values'] = TwigThemeTestUtils::phpValues(); Loading @@ -36,6 +36,8 @@ function test_theme_library_info_alter(&$libraries, $extension): void { } /** * Implements hook_theme_test_alter_alter(). * * Tests a theme implementing an alter hook. * * The confusing function name here is due to this being an implementation of Loading Loading @@ -90,15 +92,17 @@ function test_theme_theme_registry_alter(&$registry): void { } /** * Tests a theme overriding a default hook with a suggestion. * Implements hook_preprocess_HOOK() for theme_test_preprocess_suggestions. * * Implements hook_preprocess_HOOK(). * Tests a theme overriding a default hook with a suggestion. */ function test_theme_preprocess_theme_test_preprocess_suggestions(&$variables): void { $variables['foo'] = 'Theme hook implementor=test_theme_preprocess_theme_test_preprocess_suggestions().'; } /** * Implements hook_preprocess_HOOK(). * * Tests a theme overriding a default hook with a suggestion. */ function test_theme_preprocess_theme_test_preprocess_suggestions__suggestion(&$variables): void { Loading @@ -106,6 +110,8 @@ function test_theme_preprocess_theme_test_preprocess_suggestions__suggestion(&$v } /** * Implements hook_preprocess_HOOK(). * * Tests a theme overriding a default hook with a suggestion. */ function test_theme_preprocess_theme_test_preprocess_suggestions__kitten(&$variables): void { Loading @@ -113,6 +119,8 @@ function test_theme_preprocess_theme_test_preprocess_suggestions__kitten(&$varia } /** * Implements hook_preprocess_HOOK(). * * Tests a theme overriding a default hook with a suggestion. */ function test_theme_preprocess_theme_test_preprocess_suggestions__kitten__flamingo(&$variables): void { Loading @@ -120,6 +128,8 @@ function test_theme_preprocess_theme_test_preprocess_suggestions__kitten__flamin } /** * Implements hook_preprocess_HOOK(). * * Tests a preprocess function with suggestions. */ function test_theme_preprocess_theme_test_preprocess_suggestions__kitten__meerkat__tarsier__moose(&$variables): void { Loading @@ -127,6 +137,8 @@ function test_theme_preprocess_theme_test_preprocess_suggestions__kitten__meerka } /** * Implements hook_preprocess_HOOK() for theme_test_theme_class. * * Tests that a class can be loaded within a .theme file. */ function test_theme_preprocess_theme_test_theme_class(&$variables): void { Loading
core/profiles/demo_umami/themes/umami/umami.theme +11 −11 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ use Drupal\Core\Render\Element; /** * Implements hook_preprocess_HOOK() for HTML document templates. * Implements hook_preprocess_HOOK() for html. * * Adds body classes if certain regions have content. */ Loading @@ -29,7 +29,7 @@ function umami_preprocess_html(&$variables): void { } /** * Implements hook_preprocess_field(). * Implements hook_preprocess_HOOK() for field. */ function umami_preprocess_field(&$variables, $hook): void { $element = $variables['element']; Loading @@ -49,7 +49,7 @@ function umami_preprocess_field(&$variables, $hook): void { } /** * Implements hook_preprocess_block(). * Implements hook_preprocess_HOOK() for block. */ function umami_preprocess_block(&$variables): void { $variables['title_attributes']['class'][] = 'block__title'; Loading @@ -70,7 +70,7 @@ function umami_theme_suggestions_block_alter(array &$suggestions, array $variabl } /** * Implements hook_umami_preprocess_block__bundle__banner_block(). * Implements hook_preprocess_HOOK() for block--bundle--banner-block. */ function umami_preprocess_block__bundle__banner_block(&$variables): void { if (isset($variables['content']['field_content_link'])) { Loading @@ -83,7 +83,7 @@ function umami_preprocess_block__bundle__banner_block(&$variables): void { } /** * Implements hook_umami_preprocess_block__bundle__footer_promo_block(). * Implements hook_preprocess_HOOK() for block bundle footer promo. */ function umami_preprocess_block__bundle__footer_promo_block(&$variables): void { if (isset($variables['content']['field_content_link'])) { Loading @@ -94,7 +94,7 @@ function umami_preprocess_block__bundle__footer_promo_block(&$variables): void { } /** * Implements hook_preprocess_breadcrumb(). * Implements hook_preprocess_HOOK() for breadcrumb. */ function umami_preprocess_breadcrumb(&$variables): void { // We are creating a variable for the Current Page Title, to allow us to print Loading @@ -119,21 +119,21 @@ function umami_preprocess_breadcrumb(&$variables): void { } /** * Implements hook_preprocess_menu_local_task(). * Implements hook_preprocess_HOOK() for menu-local-task. */ function umami_preprocess_menu_local_task(&$variables): void { $variables['link']['#options']['attributes']['class'][] = 'tabs__link'; } /** * Implements hook_form_FORM_ID_alter(). * Implements hook_form_FORM_ID_alter() for search_block_form. */ function umami_form_search_block_form_alter(&$form, FormStateInterface $form_state): void { $form['keys']['#attributes']['placeholder'] = t('Search by keyword, ingredient, dish'); } /** * Implements hook_preprocess_links__media_library_menu(). * Implements hook_preprocess_HOOK() for links--media-library-menu. * * This targets the menu of available media types in the media library's modal * dialog. Loading Loading @@ -161,7 +161,7 @@ function umami_form_alter(array &$form, FormStateInterface $form_state, $form_id } /** * Implements hook_preprocess_image_widget(). * Implements hook_preprocess_HOOK() for image-widget. * * @todo Revisit in https://drupal.org/node/3117430 */ Loading @@ -173,7 +173,7 @@ function umami_preprocess_image_widget(&$variables): void { } /** * Implements template_preprocess_links(). * Implements hook_preprocess_HOOK() for links. * * This makes it so array keys of #links items are added as a class. This * functionality was removed in Drupal 8.1, but still necessary in some Loading
core/themes/claro/claro.theme +28 −24 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ function claro_preprocess_menu_local_task__views_ui(&$variables): void { } /** * Implements template_preprocess_HOOK() for node_add_list. * Implements hook_preprocess_HOOK() for node_add_list. * * Makes node_add_list variables compatible with entity_add_list. */ Loading Loading @@ -161,7 +161,7 @@ function claro_preprocess_node_add_list(&$variables): void { } /** * Implements template_preprocess_HOOK() for block_content_add_list. * Implements hook_preprocess_HOOK() for block_content_add_list. * * Makes block_content_add_list variables compatible with entity_add_list. * Loading Loading @@ -199,7 +199,7 @@ function claro_preprocess_block_content_add_list(&$variables): void { } /** * Implements template_preprocess_HOOK() for entity_add_list. * Implements hook_preprocess_HOOK() for entity_add_list. */ function claro_preprocess_entity_add_list(&$variables): void { // Remove description if empty. Loading @@ -225,7 +225,7 @@ function claro_preprocess_block(&$variables): void { } /** * Implements template_preprocess_HOOK() for admin_block. * Implements hook_preprocess_HOOK() for admin_block. */ function claro_preprocess_admin_block(&$variables): void { if (!empty($variables['block']['content'])) { Loading @@ -234,7 +234,7 @@ function claro_preprocess_admin_block(&$variables): void { } /** * Implements template_preprocess_HOOK() for admin_block. * Implements hook_preprocess_HOOK() for admin_block_content. */ function claro_preprocess_admin_block_content(&$variables): void { foreach ($variables['content'] as &$item) { Loading Loading @@ -851,7 +851,7 @@ function claro_preprocess_form_element(&$variables): void { } /** * Implements template_preprocess_HOOK() for input. * Implements hook_preprocess_HOOK() for input. */ function claro_preprocess_input(&$variables): void { if ( Loading Loading @@ -898,7 +898,7 @@ function claro_preprocess_input(&$variables): void { } /** * Implements template_preprocess_HOOK() for select. * Implements hook_preprocess_HOOK() for select. */ function claro_preprocess_select(&$variables): void { if (!empty($variables['element']['#title_display']) && $variables['element']['#title_display'] === 'attribute' && !empty((string) $variables['element']['#title'])) { Loading @@ -916,7 +916,7 @@ function claro_preprocess_select(&$variables): void { } /** * Implements template_preprocess_HOOK() for datetime_wrapper. * Implements hook_preprocess_HOOK() for datetime_wrapper. */ function claro_preprocess_datetime_wrapper(&$variables): void { if (!empty($variables['element']['#errors'])) { Loading @@ -933,7 +933,7 @@ function claro_preprocess_datetime_wrapper(&$variables): void { } /** * Implements template_preprocess_HOOK() for fieldset. * Implements hook_preprocess_HOOK() for fieldset. */ function claro_preprocess_fieldset(&$variables): void { $element = $variables['element']; Loading Loading @@ -1032,14 +1032,14 @@ function claro_preprocess_form_element__password(&$variables): void { } /** * Implements template_preprocess_HOOK() for filter_tips. * Implements hook_preprocess_HOOK() for filter_tips. */ function claro_preprocess_filter_tips(&$variables): void { $variables['#attached']['library'][] = 'filter/drupal.filter'; } /** * Implements template_preprocess_HOOK() for table. * Implements hook_preprocess_HOOK() for table. */ function claro_preprocess_table(&$variables): void { // Adding table sort indicator CSS class for inactive sort link. Loading Loading @@ -1083,14 +1083,14 @@ function claro_preprocess_table(&$variables): void { } /** * Implements template_preprocess_HOOK() for field_ui_table. * Implements hook_preprocess_HOOK() for field_ui_table. */ function claro_preprocess_field_ui_table(&$variables): void { claro_preprocess_table($variables); } /** * Implements template_preprocess_HOOK() for views_view_table. * Implements hook_preprocess_HOOK() for views_view_table. * * @todo Revisit after https://www.drupal.org/node/3025726 or * https://www.drupal.org/node/1973418 is in. Loading Loading @@ -1355,7 +1355,7 @@ function _claro_preprocess_file_and_image_widget(array &$variables): void { } /** * Implements hook_preprocess_views_view_fields(). * Implements hook_preprocess_HOOK() for views_view_fields__media_library. * * This targets each rendered media item in the grid display of the media * library's modal dialog. Loading @@ -1369,7 +1369,7 @@ function claro_preprocess_views_view_fields__media_library(array &$variables): v } /** * Implements hook_form_BASE_FORM_ID_alter(). * Implements hook_form_BASE_FORM_ID_alter() for media_library_add_form. */ function claro_form_media_library_add_form_alter(array &$form, FormStateInterface $form_state): void { $form['#attributes']['class'][] = 'media-library-add-form'; Loading @@ -1390,7 +1390,7 @@ function claro_form_media_library_add_form_alter(array &$form, FormStateInterfac } /** * Implements hook_form_FORM_ID_alter(). * Implements hook_form_FORM_ID_alter() for media_library_add_form_upload. */ function claro_form_media_library_add_form_upload_alter(array &$form, FormStateInterface $form_state): void { $form['#attributes']['class'][] = 'media-library-add-form--upload'; Loading @@ -1405,7 +1405,7 @@ function claro_form_media_library_add_form_upload_alter(array &$form, FormStateI } /** * Implements hook_form_FORM_ID_alter(). * Implements hook_form_FORM_ID_alter() for media_library_add_form_oembed. */ function claro_form_media_library_add_form_oembed_alter(array &$form, FormStateInterface $form_state): void { $form['#attributes']['class'][] = 'media-library-add-form--oembed'; Loading @@ -1420,7 +1420,7 @@ function claro_form_media_library_add_form_oembed_alter(array &$form, FormStateI } /** * Implements hook_preprocess_item_list__media_library_add_form_media_list(). * Implements hook_preprocess_HOOK() for item_list__media_library_add_form_media_list. * * This targets each new, unsaved media item added to the media library, before * they are saved. Loading @@ -1447,7 +1447,7 @@ function claro_preprocess_item_list__media_library_add_form_media_list(array &$v } /** * Implements hook_preprocess_media_library_item__widget(). * Implements hook_preprocess_HOOK() for media_library_item__widget. * * This targets each media item selected in an entity reference field. */ Loading @@ -1457,7 +1457,7 @@ function claro_preprocess_media_library_item__widget(array &$variables): void { } /** * Implements hook_preprocess_media_library_item__small(). * Implements hook_preprocess_HOOK() for media_library_item__small. * * This targets each pre-selected media item selected when adding new media in * the modal media library dialog. Loading @@ -1467,6 +1467,8 @@ function claro_preprocess_media_library_item__small(array &$variables): void { } /** * Implements hook_preprocess_HOOK() for fieldset__media_library_widget. * * @todo Remove this when https://www.drupal.org/project/drupal/issues/2999549 * lands. * Loading Loading @@ -1538,7 +1540,7 @@ function claro_views_pre_render(ViewExecutable $view): void { } /** * Implements hook_preprocess_links__media_library_menu(). * Implements hook_preprocess_HOOK() for links__media_library_menu. * * This targets the menu of available media types in the media library's modal * dialog. Loading @@ -1555,7 +1557,9 @@ function claro_preprocess_links__media_library_menu(array &$variables): void { } /** * Implements hook_form_FORM_ID_alter() for the Views UI rearrange filter form. * Implements hook_preprocess_HOOK() for views_ui_rearrange_filter_form. * * Views UI rearrange filter form. */ function claro_preprocess_views_ui_rearrange_filter_form(array &$variables): void { foreach ($variables['table']['#rows'] as &$row) { Loading Loading @@ -1665,7 +1669,7 @@ function claro_form_views_ui_add_handler_form_alter(array &$form, FormStateInter } /** * Implements hook_preprocess_toolbar(). * Implements hook_preprocess_HOOK() for toolbar. * * This is also called by system_preprocess_toolbar() in instances where Claro * is the admin theme but not the active theme. Loading Loading @@ -1737,7 +1741,7 @@ function claro_form_user_admin_permissions_alter(&$form, FormStateInterface $for } /** * Implements hook_form_FORM_ID_alter(). * Implements hook_form_FORM_ID_alter() for node_preview_form_select. */ function claro_form_node_preview_form_select_alter(array &$form, FormStateInterface $form_state): void { if (isset($form['backlink'])) { Loading
core/themes/olivero/olivero.theme +23 −23 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ use Drupal\user\UserInterface; /** * Implements hook_preprocess_HOOK() for page title templates. * Implements hook_preprocess_HOOK() for page-title. */ function olivero_preprocess_page_title(&$variables): void { // Since the title and the shortcut link are both block level elements, Loading Loading @@ -43,7 +43,7 @@ function olivero_preprocess_page_title(&$variables): void { } /** * Implements hook_preprocess_HOOK() for maintenance-page.html.twig. * Implements hook_preprocess_HOOK() for maintenance-page. */ function olivero_preprocess_maintenance_page(&$variables): void { // By default, site_name is set to Drupal if no db connection is available Loading @@ -59,7 +59,7 @@ function olivero_preprocess_maintenance_page(&$variables): void { } /** * Implements hook_preprocess_HOOK() for node.html.twig. * Implements hook_preprocess_HOOK() for node. */ function olivero_preprocess_node(&$variables): void { // Remove the "Add new comment" link on teasers or when the comment form is Loading @@ -82,7 +82,7 @@ function olivero_preprocess_node(&$variables): void { } /** * Implements hook_preprocess_HOOK() for block.html.twig. * Implements hook_preprocess_HOOK() for block. */ function olivero_preprocess_block(&$variables): void { if (!empty($variables['elements']['#id'])) { Loading Loading @@ -136,7 +136,7 @@ function olivero_theme_suggestions_menu_alter(&$suggestions, array $variables): } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for menu. */ function olivero_preprocess_menu(&$variables): void { if (isset($variables['attributes']['region'])) { Loading Loading @@ -205,7 +205,7 @@ function olivero_theme_suggestions_block_alter(&$suggestions, array $variables): } /** * Implements hook_preprocess_HOOK() for menu-local-tasks templates. * Implements hook_preprocess_HOOK() for menu-local-tasks. */ function olivero_preprocess_menu_local_tasks(&$variables): void { foreach (Element::children($variables['primary']) as $key) { Loading @@ -217,7 +217,7 @@ function olivero_preprocess_menu_local_tasks(&$variables): void { } /** * Implements hook_preprocess_form_element(). * Implements hook_preprocess_HOOK() for form-element. */ function olivero_preprocess_form_element(&$variables): void { if (in_array($variables['element']['#type'] ?? FALSE, ['checkbox', 'radio'], TRUE)) { Loading @@ -234,14 +234,14 @@ function olivero_preprocess_form_element(&$variables): void { } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for form-element-label. */ function olivero_preprocess_form_element_label(&$variables): void { $variables['attributes']['class'][] = 'form-item__label'; } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for input. */ function olivero_preprocess_input(&$variables): void { if ( Loading Loading @@ -291,7 +291,7 @@ function olivero_preprocess_input(&$variables): void { } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for textarea. */ function olivero_preprocess_textarea(&$variables): void { $variables['attributes']['class'][] = 'form-element'; Loading @@ -300,7 +300,7 @@ function olivero_preprocess_textarea(&$variables): void { } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for select. */ function olivero_preprocess_select(&$variables): void { $variables['attributes']['class'][] = 'form-element'; Loading @@ -310,21 +310,21 @@ function olivero_preprocess_select(&$variables): void { } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for checkboxes. */ function olivero_preprocess_checkboxes(&$variables): void { $variables['attributes']['class'][] = 'form-boolean-group'; } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for radios. */ function olivero_preprocess_radios(&$variables): void { $variables['attributes']['class'][] = 'form-boolean-group'; } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for field. */ function olivero_preprocess_field(&$variables): void { $rich_field_types = ['text_with_summary', 'text', 'text_long']; Loading @@ -340,7 +340,7 @@ function olivero_preprocess_field(&$variables): void { } /** * Implements hook_preprocess_HOOK(). * Implements hook_preprocess_HOOK() for field-multiple-value-form. */ function olivero_preprocess_field_multiple_value_form(&$variables): void { // Make disabled available for the template. Loading Loading @@ -394,7 +394,7 @@ function olivero_preprocess_field_multiple_value_form(&$variables): void { } /** * Implements hook_preprocess_HOOK() for menu-local-task templates. * Implements hook_preprocess_HOOK() for menu-local-task. */ function olivero_preprocess_menu_local_task(&$variables): void { $variables['link']['#options']['attributes']['class'][] = 'tabs__link'; Loading @@ -413,7 +413,7 @@ function olivero_preprocess_menu_local_task(&$variables): void { } /** * Implements template_preprocess_HOOK() for fieldset. * Implements hook_preprocess_HOOK() for fieldset. */ function olivero_preprocess_fieldset(&$variables): void { $element = $variables['element']; Loading Loading @@ -469,7 +469,7 @@ function olivero_preprocess_filter_caption(&$variables): void { } /** * Implements hook_form_FORM_ID_alter(). * Implements hook_form_FORM_ID_alter() for node_preview_form_select. */ function olivero_form_node_preview_form_select_alter(&$form, FormStateInterface $form_state, $form_id): void { $form['backlink']['#options']['attributes']['class'][] = 'button'; Loading @@ -480,7 +480,7 @@ function olivero_form_node_preview_form_select_alter(&$form, FormStateInterface } /** * Implements hook_preprocess_HOOK() for comment.html.twig. * Implements hook_preprocess_HOOK() for comment. */ function olivero_preprocess_comment(&$variables): void { // Getting the node creation time stamp from the comment object. Loading @@ -490,7 +490,7 @@ function olivero_preprocess_comment(&$variables): void { } /** * Implements hook_preprocess_HOOK() for field--comment.html.twig. * Implements hook_preprocess_HOOK() for field--comment. */ function olivero_preprocess_field__comment(&$variables): void { // Add a comment_count. Loading Loading @@ -524,7 +524,7 @@ function olivero_element_info_alter(&$info): void { } /** * Implements template_preprocess_text_format_wrapper(). * Implements hook_preprocess_HOOK() for text-format-wrapper. * * @todo Remove when https://www.drupal.org/node/3016343 is fixed. */ Loading Loading @@ -588,14 +588,14 @@ function olivero_preprocess_table(&$variables): void { } /** * Implements hook_preprocess_HOOK() for views-view-table templates. * Implements hook_preprocess_HOOK() for views-view-table. */ function olivero_preprocess_views_view_table(&$variables): void { $variables['#attached']['library'][] = 'olivero/olivero.table'; } /** * Implements hook_form_views_exposed_form_alter(). * Implements hook_form_FORM_ID_alter() for views_exposed_form. */ function olivero_form_views_exposed_form_alter(&$form): void { $form['#attributes']['class'][] = 'form--inline'; Loading