The l() function has changed in some aspects from D6 -> D7, but it more or less still looks the same and is used the same we just ran into this error when building a site:
Fatal error: [] operator not supported for strings in /.../includes/common.inc on line 2277
basically what happened was that the developer was using the old way of adding classes to a link: $link['attributes'] = array('class' => 'myclass'). However, 'class' now needs to be an array.
There's already a comment on that api page (http://api.drupal.org/api/drupal/includes--common.inc/function/l/7) about classes being arrays, but I think it makes sense to have it as part of the official documentation since I imagine a lot of people will probably be running into this identical error when they upgrade their modules and themes to D7.
This patch just adds a one-line change to the api documentation for the l() function.
Comment | File | Size | Author |
---|---|---|---|
#4 | 972918.patch | 973 bytes | jhodgdon |
l_api_class.patch | 554 bytes | hadsie | |
Comments
Comment #2
arianek CreditAttribution: arianek commentedhey scott i am no patch pro after not doing any for many months, but i think maybe it's missing a few lines at the top (before the line starting with diff) that usually look like:
maybe the git thing you were trying out is losing those?
Comment #3
altrugon CreditAttribution: altrugon commentedSubscribe.
Comment #4
jhodgdonGood idea...
The patch is not the right way to do it though (besides being formatted incorrectly). I think what we should do is this instead (easier to explain via a patch than in a sentence).
Comment #5
hadsie CreditAttribution: hadsie commentedThanks @jhodgdon, I like yours a lot better :)
Comment #6
joachim CreditAttribution: joachim commentedLooks good to me.
Comment #7
joachim CreditAttribution: joachim commentedThis also needs a mention in the 6-7 conversion docs page. (Which looks far too complicated for me to even think about editing before breakfast :(
Comment #8
webchickCommitted to HEAD. Thanks!
Comment #9
jhodgdonSetting back to "needs work" because (as joachim says in #7) it probably needs documenting on the (totally huge, totally out of date) module update page.
Comment #10
jhodgdonAdding the Needs Doc tag because that's how we tag for the API update page
Comment #11
jhodgdonChanging tag and version. New tag "Needs update documentation" is for issues that need doc on the update page.
Comment #12
dale42Working on for doc sprint
Comment #13
dale42Info added at http://drupal.org/update/modules/6/7#l_function
Comment #14
jhodgdonLooks good to me, thanks!