We already allow hiding fields from display and also hiding their label (we also have these options available for fields in views), but what options does one have if they need to rewrite the output of a field?...
option 1: Write custom php code, having to mess with preprocess hooks and node or field-specific template files.
option 2: "Hack" their way trying to use css :before
/:after
pseudo-elements & the content:
property.
UX problems with these two options: - Need to create your own sub-theme if you are using core or contrib, otherwise your customizations will be lost with core/contrib updates. - Have to know how to code
...don't like or can't code? Views is your friend:
option 3: Create a view showing nodes of the content type that contains the field you need to rewrite, add all the fields you need to show, add a contextual filter for nid
, override the node/%
path with that view.
UX problems with this option:
- Try to change the display of a content type a long time after you've implemented this -> ...see that your changes do not work -> ...try to figure out why -> ...remember that you have a view that controls the display -> smack forehead
- Did you override the node/%
path with a view believing that filtering by content type would leave the rest of the content types alone? Ha, think again ...now you have to account for all content types in that view -> smack forehead again
So, how about we do any or both of these:
- In each field settings on the manage display form, add the same options that we have available in views for fields:
- adding custom css classes to the field, the label or the entire field wrapper
- changing the HTML element (tag) for the field, the label, or the entire field wrapper
- custom empty value text (for optional fields) + the option to not render if empty
- rewriting the output of fields using HTML, tokens and replacement patterns
- Allow a view to be used as a display mode of a content type. Related: #2433
PS: #2605
Recent comments
I understand that this is not in the subject, but using a separate field (for <iframe> or file upload, doesn't matter) you get an advantage in displaying content. You can create blocks and...
Best way to embed media with CKEditor
I got confused by this too so I wanted to clarify the last comment here: You need to enable the input filter called: "Convert image captions to figure and figcaption elements" at the...
Image Captions
Hi I added the 2 additional settings in settings.php, did a restart - and the error disappeared! Thanks for the support! (but the issues with the conversion still remain .....
Problem with utf8mb4 Format when importing database