Active
Project:
Link
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Mar 2013 at 02:28 UTC
Updated:
12 Feb 2015 at 02:58 UTC
Jump to comment: Most recent
In hook_views_pre_render(), looping through $view->result as $row:
In version 1.0, $row->{link-field-name}[0]['rendered']['#markup'] was populated.
In version 1.1, $row->{link-field-name}[0]['rendered']['#markup'] is missing.
Why? This is inconsistent with the way other fields appear in hook_views_pre_render(), and it has majorly broken a client site that was depending on processing the view in pre-render.
Comments
Comment #1
johnpitcairn commentedOK, this is the commit that did it:
So why was that change made?
Comment #2
ilfelice commentedI have a similar problem, where I used
$content['field_company_url'][0]['#markup']to output a URL, and this is not working anymore.For now I reverted to the working version, but would also like to know if this is an unintended regression and how we are supposed to deal with this change.
Thanks!
Comment #3
deejayx commentedJorge : If you haven't found a resolution with 1.1...you can get away with:
This was driving me nuts, had just updated and instantly regretted it, I was using the same format. However, removing
['#markup']from the string and addingprint render()resolved it for me. I'm ultra new to drupal so forgive me if I did something wrong. Just registered cause I was searching for an answer and came upon a working solution for myself. Hope it helps :)Comment #4
ilfelice commentedHi deejayx!
With your fix, now I am able to use 1.1. Thank you!
Comment #5
johnpitcairn commentedStill begs the question: why is link field doing this when every other field does populate the #markup element with some basic content?
Comment #6
vegardjo commentedAlso stumbling into this, only in a preprocess_field function in my template.php. As far as I understand I should be able to change the output by altering:
$vars['items'][0][#markup]..but it is not there, I only have #type, #title and #href, and cannot find anything here where I can alter the actual output. Any ideas?
Comment #7
Drupa1ish commentedAnother workaround... From interface field configuration, section wrapper markup, choose no markup- no wrapping html
Comment #8
johnpitcairn commented@EuroDomenii: I think that option is only available if you are using Display Suite or some other module that provides extended formatter options?
Comment #9
Drupa1ish commented@John Pitcairn My testing was on a https://drupal.org/project/commerce_kickstart distribution, I didn't check on native drupal installation.
An alternative, better solution than #7 could be directly in views:
At field level Style settings
Uncheck any of following options Customize field HTML, Customize field and label wrapper HTML, Use field template
Check Add default classes
Comment #10
michelleI've been running into the same problem as #6. Any update on why #markup was removed and if it can be put back?
Comment #11
damienmckennaI wonder how much effort it'd be to write a conversion script to switch to URL instead?
Comment #12
johnpitcairn commentedURL module is for external links only isn't it? Link module also supports internal paths, and there are autocomplete widgets available for selecting internal paths (I wrote a CKEditor Link widget for it to provide consistent linking UI from a field or from wysiwyg).