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.

Files: 
CommentFileSizeAuthor
#6 use-attached-for-css-1122584-4.patch607 bytesRobLoach
PASSED: [[SimpleTest]]: [MySQL] 36,065 pass(es).
[ View ]
#3 use-attached-for-css-1122584-3.patch619 bytesdavisben
PASSED: [[SimpleTest]]: [MySQL] 32,908 pass(es).
[ View ]

Comments

Status:Active» Needs review

Drupal 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?

<?php
  $form
['blocks'] = array(
   
'#attached' => array(
     
'css' => array(drupal_get_path('module', 'block') . '/block.css')
    )
  );
?>

Status:Needs review» Needs work

Not sure. I would rather write

<?php
  $form
['#attached']['css'] = array(
   
drupal_get_path('module', 'block') . '/block.css'),
  );
?>

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.

Status:Needs work» Needs review
StatusFileSize
new619 bytes
PASSED: [[SimpleTest]]: [MySQL] 32,908 pass(es).
[ View ]

Here's a patch.

Status:Needs review» Reviewed & tested by the community

Looks good to me.

Issue tags:+needs backport to D7

Committed 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.

Status:Reviewed & tested by the community» Needs review
StatusFileSize
new607 bytes
PASSED: [[SimpleTest]]: [MySQL] 36,065 pass(es).
[ View ]

Version:8.x-dev» 7.x-dev
Issue tags:-needs backport to D7

Status:Needs review» Needs work
Issue tags:-Novice, -dgd7

The last submitted patch, use-attached-for-css-1122584-4.patch, failed testing.

Status:Needs work» Needs review
Issue tags:+Novice, +dgd7

#6: use-attached-for-css-1122584-4.patch queued for re-testing.

Status:Needs review» Reviewed & tested by the community

Status:Reviewed & tested by the community» Fixed
Issue tags:+needs backport to D7

This 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!

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