API page: http://api.drupal.org/api/drupal/core!includes!common.inc/function/drupal_add_js/8
API page: http://api.drupal.org/api/drupal/includes!common.inc/function/drupal_add_js/7

On the "parameters" paragraph of the documentation, the first line describing the the $data parameter should be (changes/corrections underlined):

$data: (optional) If given, the value depends on the $options[type] parameter:

instead of:

$data: (optional) If given, the value depends on the $options parameter:

P.S.:Since I am relatively new in Drupal development please double-check the correction above before you fix it.

Files: 
CommentFileSizeAuthor
#12 minor_documentation_correction-1821024-12.patch697 bytesdermario
PASSED: [[SimpleTest]]: [MySQL] 46,233 pass(es). View
#8 minor_documentation_correction-1821024-8.patch632 bytesdermario
PASSED: [[SimpleTest]]: [MySQL] 46,243 pass(es). View
#5 minor_documentation_correction-1821024-5.patch630 bytesmjonesdinero
PASSED: [[SimpleTest]]: [MySQL] 46,226 pass(es). View

Comments

earnie’s picture

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

We need to consider D8 first.

fizk’s picture

Status: Active » Fixed

Seems to be fixed now.

bitspike’s picture

I don't see how it is fixed. It looks the same to me. Please explain so I won't reopen issue without a reason.

fizk’s picture

Status: Fixed » Active

Sorry I read the issue description wrong.

mjonesdinero’s picture

Assigned: Unassigned » mjonesdinero
Status: Active » Needs review
FileSize
630 bytes
PASSED: [[SimpleTest]]: [MySQL] 46,226 pass(es). View

attached is the solution on d8

dermario’s picture

Status: Needs review » Reviewed & tested by the community

#5 looks good to me. Patch applys well and changes are made like in issue summary.

jhodgdon’s picture

Status: Reviewed & tested by the community » Needs work

Good catch! It needs to say $options['type'] though, not $options[type].

dermario’s picture

FileSize
632 bytes
PASSED: [[SimpleTest]]: [MySQL] 46,243 pass(es). View

hope thats ok now

dermario’s picture

Status: Needs work » Needs review
fizk’s picture

Good catch! It needs to say $options['type'] though, not $options[type].

Actually if the options parameter is a string, then it will be interpreted as the type:

$options: (optional) A string defining the type of JavaScript that is being added in the $data parameter ('file'/'setting'/'inline'/'external'), or an associative array.

So saying $options['type'] isn't always right.

We could say something like

(optional) If given, the value depends on the $options parameter, or $options['type'] if $options is passed as an associative array.

fizk’s picture

Status: Needs review » Needs work
dermario’s picture

Assigned: mjonesdinero » dermario
FileSize
697 bytes
PASSED: [[SimpleTest]]: [MySQL] 46,233 pass(es). View

Ok you are right and your sentence is more precise.

dermario’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: -Novice, -needs backport to D7

The last submitted patch, minor_documentation_correction-1821024-12.patch, failed testing.

jhodgdon’s picture

Status: Needs work » Needs review
Issue tags: +Novice, +needs backport to D7
jhodgdon’s picture

Assigned: dermario » jhodgdon
Status: Needs review » Reviewed & tested by the community

Looks good, thanks! I'll get this committed sometime soon.

jhodgdon’s picture

Sorry for the delay in committing this -- there's a big Views sprint going on and commits are delaying their patch reviews, so postponing a few days.

jhodgdon’s picture

Assigned: jhodgdon » Unassigned
Status: Reviewed & tested by the community » Fixed

Thanks again! Committed to 8.x and 7.x.

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

Anonymous’s picture

Issue summary: View changes

HTML anchor added on API page.