Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
6.x-3.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Jun 2010 at 11:38 UTC
Updated:
19 Aug 2012 at 21:47 UTC
I want to combine the [type] and [entity_id] (body field) as well as control the output of it.
For the [type] I have excluded it and rewritten the output to:
<strong><em>[type] - </em></strong>
For the [entity_id] I have rewritten the output to:
[type][entity_id]
I have also set it to strip the HTML tags.
The problem is that is also strips the HTML tags for the [type].
This sort of limits the way I can format the output. It would be great if the Strip HTML tags option only strips the tags for the field it is set for, not any fields in the rewrite textarea.
Alternatively have two options:
- Strip HTML tags for this field only
- Strip all HTML tags
Comments
Comment #1
tsvenson commentedI did some more testing with this and checking the strip HTML tags option renders the rewrite useless. It seems to me that the strip HTML tags is applied after all the other rendering is done and then.
Personally I would like it to default to strip HTML tags for the field content it is set for before any rewrites or other formattings are made.
Comment #2
dawehnerI don't think we can trust the user here, moving the DRUPAL-6--3 because this is the current version were features will be handled
Comment #3
merlinofchaos commentedThe workaround is to use global: custom field. The normal field has strip applied, adn then its token is used in the custom field with your HTML. Maybe not elegant but it's safer and easier.
Comment #4
alanom commentedThis isn't a complete workaround, since the rewritten markup in your Global: Customfield will be displayed even if the field it wraps around is empty.
If this is a problem, here is an (even uglier) workaround that still maintains the feature of not trusting the user (not 100% sure why this is a feature since surely if they were malicious and ha access to Views UI they could just untick the 'Strip HTML' box, but that's a seperate debate) but which only shows the rewritten markup if the field is non-empty.
Example use case: You're trying to wrap a custom link around a Media-module File field showing a Youtube thumbnail from earlier stable versions where the only formatters loaded into Views linked thumbnails to the Media entity (call it Field: Video). You want to remove the
<a>tags the formatter wraps around an<img>, then wrap your own<a>tag around it - only if the field is actually present in this row. (maybe there's another way to do this in Media, if so, imagine there wasn't and just treat this as an illustrative example)<img>but nothing else)So the second field, only if not empty, shows the first (stripped) field wrapped in its own (non-stripped) markup.