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.
I think this documentation has errors:
* defer If set to TRUE, the defer attribute is set on the <script> tag. Defaults to FALSE.
* cache If set to FALSE, the JavaScript file is loaded anew on every page call, that means, it is not cached. Used only when 'type' references a JavaScript file. Defaults to TRUE.
* preprocess Aggregate the JavaScript if the JavaScript optimization setting has been toggled in admin/config/development/performance. Note that JavaScript of type 'external' is not aggregated. Defaults to TRUE.
IMO that should be after weight into $options in "Parameters" section. I have not tested yet but other way it makes no sense for me where to pass those parameters to the function.
see drupal_get_js()
well, that would fit anywhere, maybe inside a See also section.
Comment | File | Size | Author |
---|---|---|---|
#14 | 621902smallfix.patch | 8.7 KB | jhodgdon |
#12 | drupal_add_js_docs_621902_12.patch | 8.57 KB | mfer |
#8 | 621902new.patch | 8.72 KB | jhodgdon |
#3 | 621902.patch | 8.78 KB | jhodgdon |
Comments
Comment #1
manfer CreditAttribution: manfer commentedthe lines out of place that should be after weight are a little more ones:
Comment #2
jhodgdonThis is caused by blank lines within a @param section of a documentation header. Needs to be fixed in both Drupal 7 and Drupal 6.
Comment #3
jhodgdonHere's a patch that should fix up the doc for drupal_add_js() -- above issues, bring it into coding standards compliance, fix some wording, grammar, spelling, etc.
Comment #5
grendzy CreditAttribution: grendzy commentedpatch no longer applies to HEAD.
Comment #6
jhodgdon#3: 621902.patch queued for re-testing.
Comment #8
jhodgdonHere's a new patch.
Comment #9
jhodgdonI just marked #651706: drupal_add_js() documentation needs more detail as a duplicate of this issue, because this patch (I hope) fixes all the things listed there as well.
Comment #10
grendzy CreditAttribution: grendzy commentedit looks like there's one extra space at the beginning of the line?
"to to" should be corrected.
Besides these 2 nits, it looks good.
Powered by Dreditor.
Comment #11
jhodgdonGood catches! Does need a small patch revision.
Comment #12
mfer CreditAttribution: mfer commentedThis patch fixes the issues from #10 and updates the copy for the weight option. It was not correct. The weight for jquery was updated, info was added about jquery.once.js, and the weighting note for inline js was removed because it is no longer relevant.
Comment #13
jhodgdonOne thing (my fault from earlier patches): The first line of the doc should say "Adds" rather than "Add" to conform with our doc standards.
Also, (again from earlier patches) maybe the code stuff here should be in a @code and all on one line:
Replace with:
Otherwise, looks good...
Comment #14
jhodgdonHere's a patch with those two small changes. Taking the liberty of marking RTBC at this point...
Comment #15
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks!
Comment #16
mfer CreditAttribution: mfer commentedLooking in CVS and at the commit messages it doesn't look like #14 was committed.
Comment #17
jhodgdonAgreed, looking at drupal_add_js() in HEAD, that change hasn't been made. Good catch, mfer!
Comment #18
webchickReally committed to HEAD this time. ;)