Code implementing hook_page_attachments names parameter incorrectly

Created on 9 February 2015, over 10 years ago
Updated 31 January 2023, over 2 years ago

function hook_page_attachments has "array &$attachments" for the parameter but every implementation of it listed in the docs below has "function MODULENAME_page_attachments(array &$page) {"

In Beta 6, at least, $attachments seems to be the correct one because that's inline with what I'm seeing in the debugger.

📌 Task
Status

Needs work

Version

10.1

Component
Theme 

Last updated about 11 hours ago

Created by

🇺🇸United States michelle Wisconsin, USA

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

    At this time we will need a D10 version of the patch
    Also a rescan of functions that may not be in the D8 patch.

    Please do not just reroll without showing you searched

  • Assigned to sahilgidwani
  • 🇮🇳India sahilgidwani Jaipur

    I will reroll the patch.
    Also, @smustgrave should we change the issue version to D10?

  • Status changed to Needs review over 2 years ago
  • 🇮🇳India sahilgidwani Jaipur

    I have searched for the hook_page_attachments occurrences throughout the D10 core and created a new patch for D10, also changed version of this issue to 10.1.x.
    Moving it to needs review.

  • Status changed to RTBC over 2 years ago
  • 🇺🇸United States smustgrave

    Thank you for working on this.

    Sorry didn't see your comment #17 until now but yes 10.1 is correct version

    Applied the patch in #18 and searched the core repo for "Implements hook_page_attachments()" found 11 instances
    They all appear to have the correct parameter name and the functions code were updated also to use attachements vs page.

    Great work @sahilgidwani

  • Status changed to Needs work over 2 years ago
  • 🇺🇸United States bnjmnm Ann Arbor, MI

    The argument is the page render array, so $page is a good name, and probably why it's used in so many spots. Renaming to $attachments makes the variable name less accurate. Going in the other direction also means significantly fewer changes, it should only require changing the hook definition/example in theme.api.php

Production build 0.71.5 2024