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.
API page: http://api.drupal.org/api/drupal/core%21includes%21common.inc/function/l/8
The docblock for l()
needs improvement. It has at least the following issues:
- It doesn't specify all
@param
or@return
types. - It doesn't specify the parameter defaults.
- It doesn't indicate whether the
$text
should be translated witht()
or not. - It doesn't
@see
closely-related functions. - It has the tiniest little grammar mistake.
Patch to follow.
Comment | File | Size | Author |
---|---|---|---|
#3 | drupal-l-1779120-3.patch | 2.05 KB | TravisCarden |
#3 | interdiff-1779120-1-3.txt | 1.24 KB | TravisCarden |
#1 | drupal-l-1779120-1.patch | 2.13 KB | TravisCarden |
Comments
Comment #1
TravisCarden CreditAttribution: TravisCarden commentedNitpick!: The comma here implies a compound sentence break, but without an explicit subject after it, this isn't one.
$text
needs to be translated, and add an example as a fast, visual reminder.Indicate the default value of the parameter.
url()
is closely-related. It's not only used inl()
, but sometimes it's a good alternative to it.Comment #2
jhodgdonThat example you added, IMO, is entirely unnecessary. We aren't going to add usage examples to every function, and this one particularly doesn't need one since the function is called hundreds of times in core.
Also, this change in the patch:
This needs to be done in a different way. The sentence that was there was preparing for a list that follows. Adding that other sentence there breaks that.
Other that that... I don't have a problem with adding @see url and the param/return types, so that part is fine. Thanks!
Comment #3
TravisCarden CreditAttribution: TravisCarden commentedOkay. Then how about this?
Comment #4
jhodgdonMuch better, thanks! I'll get this one committed shortly.
Comment #5
jhodgdonThanks again! Committed to 8.x and 7.x.