Currently, we can attach any data to a renderable array, with the #attach property. Depending of the type of the data, a callback function is used to accomplish a specific task during the rendering of the structure. For example, add Javascript or CSS files, send headers, add tags to the page head, etc...
However, these functions have different parameters, making it extremely difficult to attach structures without making mistakes in the syntax, order of parameters, etc...
We should consider normalizing the parameters of the drupal_add_* functions, such that they receive only one parameter in form of a keyed array. This will allow us to attach data using a simpler syntax, and we can add most common options as defaults.
Related issue: #569280: Remove special-case code in drupal_process_attached() for js and css
Comments
Comment #1
pasqualleThis was fixed in D7.
drupal_add_css()