Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The user_profile theme hook does not seem to have or act on $variables['content'].
Thus, even when $variables['content']['#prefix'] is set correctly by rdf_process using theme_rdf_metadata, the metadata does not show up on the user profile page.
Comment | File | Size | Author |
---|---|---|---|
#25 | rdf_process-user_702664_26.patch | 4.99 KB | marcingy |
#24 | rdf_process-user_702664_24.patch | 4.99 KB | marcingy |
#19 | rdf_process-user_702664_19.patch | 5.11 KB | linclark |
#17 | rdf_process-user_702664_17.patch | 5.11 KB | linclark |
#15 | rdf_process-user_702664_15.patch | 5.11 KB | linclark |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedForgot tag
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedChecks whether $variables['content'] or or $variables['user_profile'] is set and attaches the #prefix value to the correct variable.
Comment #3
scor CreditAttribution: scor commentedWe are hard-coding things. We should check to see if this missing 'content' key is expected or if it's a bug in the user module. What other modules/entity do we need to add to this list? It would be better if we could standardize on 'content', or at least forsee what are the other special cases...
leaving status "needs review" hoping to get feedback on this.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedThe offending code is in user.pages.inc
Comment #5
scor CreditAttribution: scor commentedLooks like this is a common pattern in HEAD:
We should check whether it would make more sense to standardize on
$variables['content']
or if there is a valid reason for having a different key name here (which looks like the hook name).Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedStandardizing on 'content' would require a lot of changes in the theme layer. Since it seems to be standardized on hook name already, this patch uses that.
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedActually, this breaks it in comment, so nevermind.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedComment and node are the only ones that use 'content' for their template variable. If all others use the hook name, we may want to see if those could be standardized to use hook name rather than the other way around.
Comment #9
scor CreditAttribution: scor commentedmaking title more generic
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedIf the variable is either 'content' or the theme hook name, this patch would be an alternate option to standardizing. Same patch as #2, it checks whether 'content' is set and if not, sets the variable name to the theme hook name.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedChanging title because it does work for preprocess_node and preprocess_comment.
Comment #12
effulgentsia CreditAttribution: effulgentsia commentedsubscribing for review later.
Comment #13
effulgentsia CreditAttribution: effulgentsia commentedThis is great. Let's make the test a little more robust by checking that 'content' is both not empty and an array. We should apply the same test to $hook, and if that also fails, then we don't have any render array variable to apply metadata to, so not get into the if block.
Also, what do you think of $content_variable instead of $variable_name?
Why different indentation of replacement code?
This review is powered by Dreditor.
Comment #14
effulgentsia CreditAttribution: effulgentsia commentedAlso, if there is a real use-case of user_profile needing metadata, please include that in this patch, along with a test for it, so the fix in this patch gets some test coverage. Thanks!
Comment #15
Anonymous (not verified) CreditAttribution: Anonymous commentedThanks for the review, I just noticed that there were new comments on this yesterday.
Great comments, I incorporated them all. We solved the problem in the case of user_profile by just adding the RDF in a meta tag, but I use that as the test case in the tests.
Comment #16
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #17
Anonymous (not verified) CreditAttribution: Anonymous commentedNew and improved! (with less whitespace thanks to the new version of Dreditor)
Comment #18
effulgentsia CreditAttribution: effulgentsia commentedAwesome. Thanks! Tiny nit:
s/else if/elseif/
143 critical left. Go review some!
Comment #19
Anonymous (not verified) CreditAttribution: Anonymous commentedThanks, fixed now.
Comment #20
effulgentsia CreditAttribution: effulgentsia commentedThanks!
Comment #21
realityloop#19: rdf_process-user_702664_19.patch queued for re-testing.
Comment #22
marcingy CreditAttribution: marcingy commented#19: rdf_process-user_702664_19.patch queued for re-testing.
Comment #23
Dries CreditAttribution: Dries commentedThis patch no longer applies. Needs a reroll so moving to 'needs work'.
Comment #24
marcingy CreditAttribution: marcingy commentedReroll against head.
Comment #25
marcingy CreditAttribution: marcingy commentedhadn't updated head above patch will fail.
Comment #26
Anonymous (not verified) CreditAttribution: Anonymous commentedThis should hopefully no longer be an issue once #1778226: [META] Fix RDF module is completed.