Closed (won't fix)
Project:
Fences - Semantic field markup and classes
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Jan 2013 at 13:05 UTC
Updated:
12 Aug 2022 at 08:22 UTC
Jump to comment: Most recent
Comments
Comment #1
lsolesen commentedComment #2
kevinquillen commentedDoes this exist yet?
Comment #2.0
kevinquillen commentedSummarized the issue request.
Comment #3
pere orgaSee also comment #4 in #1700154: fences vs display suite
Comment #4
moriartie commentedI made a module which makes it possible to override the global fences wrapper field setting per display: https://github.com/maoberlehnerdrupal/fences_display_specific_wrapper
Comment #5
drupa11y commentedThanks for the responses, I´ll check out the module.
Comment #6
marcvangendThanks for the module, Moriartie. I'm impressed that there are only 81 lines of code in the .module file :-) I hope to try it out soon.
Comment #7
moriartie commentedIt's just a very simple module - and the module has a dependency to the field_formatter_settings module that makes it very easy to alter / add field formatters. Please report back if you like the module. :)
Comment #8
johnalbinDifferent markup? Nope. Semantics is semantics. You shouldn't need different markup on different display modes.
As for different classes (i.e. different design) on different view modes, I use https://www.drupal.org/project/field_formatter_class
Comment #9
drupa11y commentedThanks John, the "Field Formatter Class" is an excellent choice.
And thanks moriartie for the new module, will check it out.
Comment #10
moriartie commentedBut there is at least one very important exception to that rule: Headlines
In addition to fences I also use the Title module - this modules makes it possible to treat the Title field like a real field so I can use fences markup on it and I can place the Title field in my view modes just like every other field (similar to how it is in display suite layouts)
So on my nodes, the title field gets the h1 fences markup on default and I output it as such in my default view mode. But then I have a view which outputs some nodes with the view mode "teaser" - semantically it makes no sense to output them with the title as h1 - so I use my module to set the title markup to h2 on the view mode "teaser"
I'm aware of that this is a little bit of a "non standard" setup, because how I use the title field to replace the default page title and so on - but I guess there are also cases with headlines in more default like setups without the title field. Jus in my case I need this function on almost every node type i create. Others may need it only in edge cases when they make a sub headline that schould be h2 in the full view mode and h3 when displayed as teaser.
Comment #11
marcvangendMore use cases for different settings per viewmode: https://www.drupal.org/node/1700154#comment-8845735.
And one more: The view mode settings allow you to limit a multi-value field to just one item. For instance, on the teaser you can display only the first image of a multi-value image field. A ul or ol element makes sense as default, but when there's only one image I'd rather have a different wrapper (or none).
If you say "my module will not support your edge case", I can live with that. But IMHO "semantics is semantics" is over-simplifying things.
Comment #12
johnalbinFair point.
From that linked issue:
Sure is. Fences does its "magic" by setting a very-low priority theme hook suggestion. So if you want to use a different template for a particular view mode, you can just set your own theme hook suggestion in a preprocess function. In fact, you can even use one of Fences' templates:
I'll re-consider this, but I think it would over-complicate the interface for this edge-case.
Comment #13
frobI have done a lot of work with higher ed sites. It would have been a god send to have these settings in the field formatter on a per display mode bases. The title field use-case alone would have made accessibility issues just go away for me. As it was we had to do, almost exactly what you are suggesting we do.
Comment #14
anybodyFor Drupal 8+ (2.x) this is possible. For Drupal 7 we won't add this anymore, sorry.
Last comment 7Y ago ;)