Add array return to all hook_theme_suggestions_HOOK implementations

Created on 21 January 2025, 8 days ago

Problem/Motivation

See 📌 [META] Add return types to hook implementations Active

Steps to reproduce

Proposed resolution

Add return type to these functions

  • block_theme_suggestions_block
  • system_theme_suggestions_html
  • system_theme_suggestions_page
  • system_theme_suggestions_maintenance_page
  • system_theme_suggestions_region
  • system_theme_suggestions_field
  • theme_test_theme_suggestions_theme_test_preprocess_suggestions
  • theme_test_theme_suggestions_theme_test_suggestion_provided
  • theme_test_theme_suggestions_node
  • taxonomy_theme_suggestions_taxonomy_term
  • search_theme_suggestions_search_result

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component

theme system

Created by

🇦🇺Australia mstrelan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @mstrelan
  • Merge request !10964Resolve #3501024 "Theme suggestions hook" → (Open) created by mstrelan
  • Pipeline finished with Success
    8 days ago
    Total: 357s
    #401344
  • 🇮🇳India hetal.solanki

    @mstrelan

    After step reproduce in Drupal version 11.x-dev and checkout branch.

    So the MR!10964 looks good to me. That's why moving this issue to RTBC!

    Thank you!!

  • 🇳🇿New Zealand quietone

    I applied the diff and searched and still see instances without a return type. Is there a reason these are excluded?

    (11.x)$ git grep  "function.*_theme_suggestions" | grep ") {" 
    core/lib/Drupal/Core/Render/theme.api.php: * function node_theme_suggestions_node(array $variables) {
    core/lib/Drupal/Core/Render/theme.api.php: * function MY_MODULE_theme_suggestions_alter(array &$suggestions, array &$variables, $hook) {
    core/lib/Drupal/Core/Render/theme.api.php:function hook_theme_suggestions_alter(array &$suggestions, array &$variables, $hook) {
    core/lib/Drupal/Core/Render/theme.api.php: * function MY_MODULE_theme_suggestions_node_alter(array &$suggestions, array $variables) {
    core/lib/Drupal/Core/Render/theme.api.php:function hook_theme_suggestions_HOOK_alter(array &$suggestions, array &$variables) {
    core/modules/big_pipe/big_pipe.module:function big_pipe_theme_suggestions_big_pipe_interface_preview(array $variables) {
    core/modules/node/node.module:function node_theme_suggestions_node(array $variables) {
    core/modules/views_ui/views_ui.module:function views_ui_theme_suggestions_views_ui_view_preview_section(array $variables) {
  • 🇦🇺Australia mstrelan

    Looks like I missed some.

    Fixed and added to the IS:

    • node_theme_suggestions_node
    • big_pipe_theme_suggestions_big_pipe_interface_preview
    • views_ui_theme_suggestions_views_ui_view_preview_section

    These are alter hooks that return void and have not been updated here.

    • MY_MODULE_theme_suggestions_alter
    • hook_theme_suggestions_alter
    • MY_MODULE_theme_suggestions_node_alter
    • hook_theme_suggestions_HOOK_alter
  • Pipeline finished with Canceled
    5 days ago
    Total: 215s
    #404327
  • Pipeline finished with Success
    5 days ago
    #404332
Production build 0.71.5 2024