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 form provided in this function is a renderable element and should use the more flexible #attached property rather than drupal_add_css() in the function.
Comment | File | Size | Author |
---|---|---|---|
#6 | use-attached-for-css-1122584-4.patch | 607 bytes | RobLoach |
#3 | use-attached-for-css-1122584-3.patch | 619 bytes | davisben |
Comments
Comment #1
barbi CreditAttribution: barbi commentedDrupal newbie here.
Can you please let me know where in the form tree does the #attached go?
I am trying to add it to the $form['blocks']. Is this right?
Comment #2
DjebbZ CreditAttribution: DjebbZ commentedNot sure. I would rather write
Basically just removing the "blocks" entry, because it needs to be attached to the whole form. Read the Form API reference on api.drupal.org.
You should try to provide a patch for this.
Comment #3
davisbenHere's a patch.
Comment #4
lambic CreditAttribution: lambic commentedLooks good to me.
Comment #5
Dries CreditAttribution: Dries commentedCommitted to 8.x. This is a candidate for backporting to 7.x. I'm moving this to webchick's queue so she can consider committing this to 7.x.
Comment #6
RobLoachComment #7
RobLoachComment #9
RobLoach#6: use-attached-for-css-1122584-4.patch queued for re-testing.
Comment #10
lambic CreditAttribution: lambic commentedComment #11
webchickThis doesn't look like it'll change anything as far as what CSS is shown on the page; merely how it's added.
Committed and pushed to 7.x. Thanks!