Follow-up to #565496: Allow dynamic attaching of other types of stuff to render() structures - we should be able to clean up the data set on #attach so that we can remove the special casing code for 'js' and 'css'

Comments

pwolanin’s picture

Title: Remove special-case code indrupal_process_attached() for js and css » Remove special-case code in drupal_process_attached() for js and css
dropcube’s picture

For Javascript, would be good to have:

$build['#attached']['js'] = array('misc/ajax.inc);
$build['#attached']['js_inline'] = array('(function($){ $.get(' . drupal_to_js(url('system/run-cron-image')) . '); })(jQuery);');
$build['#attached']['js_setting'] = array($settings);
$build['#attached']['js_external'] = array('http://example.com/example.js');

It's very confusing, and hard to remember how to pass the parameters for each case.

sun’s picture

Issue tags: +API clean-up

Tagging.

Can we have a better summary of the problem in here, please?

mattyoung’s picture

sub

sun’s picture

I wonder whether this is still in the loop for D7...? Remembering all the different data structures is a big WTF.

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.