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
Thanks Alejandro. That was the clues I needed.
Ubercart - Programmatically add product to cart and straight to Checkout
Have you tried uc_cart_add_item()? You need to provide the nid of the product. Then you can use backdrop_goto('cart/checkout'); to send the user to the checkout screen. uc_cart_add_item...
Ubercart - Programmatically add product to cart and straight to Checkout
No problem, let's see how it evolves. I'd be happy to provide a suggested version if i could. I will keep that in mind and try learn this hook chain hopefully very soon. I will...
File hashing uploads made through TinyMCE