Add array return to all hook_theme_suggestions_HOOK implementations

Created on 21 January 2025, about 2 months 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" → (Closed) created by mstrelan
  • Pipeline finished with Success
    about 2 months 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
    about 2 months ago
    Total: 215s
    #404327
  • Pipeline finished with Success
    about 2 months ago
    #404332
  • 🇺🇸United States smustgrave

    Pretty simple review. Applied the MR and searched for Implements hook_theme_suggestions_HOOK(). and all findings had a return type added.

  • 🇳🇿New Zealand quietone

    Sorting the list in the IS to make it easier to compare with local results.

  • 🇳🇿New Zealand quietone

    I repeated what I did in #6. Then did some more work with grep and awk to get a list of the changes to compare my local results with the IS. There is one additional change in the MR not listed in the IS, hook_theme_suggestions_HOOK. I added that to the IS.

    @hetal.solanki, thank you for working on this issue. To receive credit for setting an issue to RTBC it expected that you comment on exactly what you did to review the issue. This is true even for what seems to be straightforward issues. There is more information in the How is credit granted for Drupal core issues → document.

    Committed 7272dc9 and pushed to 11.x. Thanks!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024