5

I'm using a template file like (views-view-field.tpl.php) to modify the output of a specific Drupal 7 Views Field.

I'm trying to modify the field and then use it back in the Views visual editor as a replacement pattern. The problem is it uses the original $output when it is used as a replacement pattern in the other fields' rewritten output (instead of using what I modified in the themed template file).

Is there anyway to do this? I'm trying to avoid going in and theming the other fields just to use the modified first one.

  • user $row instead of $output, you may able to see all the fields which you added in views. write the below snippet and check it out >print_r($row); – Tharick Jan 7 '16 at 7:06
  • No, it doesn't matter which variable you use if Drupal is ignoring the entire file... – user568458 Apr 22 '16 at 17:06
1

If you make this field the displayed field it will take the theme adjustments. Do your rewrite and replacement patters on this field, put it at the end of the field list and exclude the others. If this field is used as a replacement pattern the theme will not be applied.

  • This is correct. Once you enter the world of using views-view-field.tpl.php to override the display of certain fields, you can't then go back into UI views to combine and manipulate things with rewrite and tokens. Try doing it all in the template files instead. – squarecandy Nov 2 '16 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.