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.
the render link breaks if option link_to_user is set to FALSE.
Because in that case the uid additional_field is not included in views_handler_field_user.
So I suggest a slight reshuffling of this function from
function render_link($data, $values) {
$uid = $this->get_value($values, 'uid');
if (!empty($this->options['link_to_user']) && user_access('access user profiles') && $uid) {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = 'user/' . $uid;
}
if (empty($data)) {
$lang = language_default();
}
else {
$lang = language_list();
$lang = $lang[$data];
}
return $this->sanitize_value($lang->name);
}
to
function render_link($data, $values) {
if (!empty($this->options['link_to_user'])) {
$uid = $this->get_value($values, 'uid');
if (user_access('access user profiles') && $uid) {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = 'user/' . $uid;
}
}
if (empty($data)) {
$lang = language_default();
}
else {
$lang = language_list();
$lang = $lang[$data];
}
return $this->sanitize_value($lang->name);
}
Comment | File | Size | Author |
---|---|---|---|
#12 | views-1472048-12.patch | 633 bytes | dev16.addweb |
|
Comments
Comment #1
dawehnerIt would be kind of cool if you could provide a real pach, see http://drupal.org/patch/submit how to do it, if you don't know it already.
With a pach it's much easier to apply/review the changes.
Comment #2
matslats CreditAttribution: matslats commentedSorry my engagement doesn't stretch that far!
Comment #3
dawehnerCommon, you know how to write patches...
Comment #4
matslats CreditAttribution: matslats commentedok here's my first drupal patch
I don't see why my making a patch is so much more helpful...
If it was my module I would want to review the code line by line anyhow.
I guess it means the code is more likely to be tested.
I haven't tested this coz I've completely lost the context where I found the bug.
Comment #5
dawehnerThe change looks perfect, thanks! Let's see what the testbot thinks about that, but i doubt that there is a test in this region.
Comment #6
tim.plunkettI don't understand the problem from the OP enough to grasp what this patch solves.
Can we have a better description? Sorry.
Comment #7
tim.plunkettComment #8
dawehnerHere is my short description.
If "link to user" is checked the field_user handler adds "uid" to the fields, so it can be used for linking a field to it's user.
The field_language handler though require to have uid set because
is called everytime, also if "link to user" is not checked.
The patch simply moves this into the if.
Comment #9
dawehnerMarking this as RTBC wasn't meant to be a april fool hoax, sorry.
Committed this to 7.x-3.x and 8.x-3.x, maybe this needs to be backported to 6.x-3.x
Comment #10
peterpoe CreditAttribution: peterpoe as a volunteer commentedThe patch didn't move the call to get_value, it just duplicated it. This causes errors when some module executes full bootstrap in a custom language provider (don't ask me why). It's crazy that nobody noticed in 4 years!
Anyway, patch attached.
Comment #11
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 3 year old patch in #10 to views_handler_field_user_language.inc does not apply to the latest views 7.x-3.x-dev and if still relevant needs to be rerolled.
Comment #12
dev16.addweb CreditAttribution: dev16.addweb at AddWeb Solution Pvt. Ltd. commented@Chris2, Please review my updated patch that will work for you in the latest views 7.x-3.x-dev. Let me know if you are facing any challenges.
Thanks!,.
Comment #13
DamienMcKenna