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

johnpitcairn’s picture

OK, this is the commit that did it:

commit fad5c7395a16a58f51d48b95d550a8451123c6ed
Author: John Fiala <jcfiala@gmail.com>
Date:   Wed Feb 6 19:42:57 2013 -0700
By jcfiala: Removed all places where #markup was being set to a theme function output with #theme.

So why was that change made?

ilfelice’s picture

I 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!

deejayx’s picture

Jorge : If you haven't found a resolution with 1.1...you can get away with:

print render($content['field_company_url'][0]); 

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 adding print 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 :)

ilfelice’s picture

Hi deejayx!

With your fix, now I am able to use 1.1. Thank you!

johnpitcairn’s picture

Still begs the question: why is link field doing this when every other field does populate the #markup element with some basic content?

vegardjo’s picture

Also 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?

Drupa1ish’s picture

Another workaround... From interface field configuration, section wrapper markup, choose no markup- no wrapping html

johnpitcairn’s picture

@EuroDomenii: I think that option is only available if you are using Display Suite or some other module that provides extended formatter options?

Drupa1ish’s picture

@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

michelle’s picture

Title: Regression? views row #markup missing in hook_views_pre_render() » Regression? #markup missing
Issue summary: View changes

I've been running into the same problem as #6. Any update on why #markup was removed and if it can be put back?

damienmckenna’s picture

I wonder how much effort it'd be to write a conversion script to switch to URL instead?

johnpitcairn’s picture

URL 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).