- Issue created by @fbreckx
- 🇳🇱Netherlands johnv
You may copy/change the complex formatter, (which is a list of formatters) and remove the regular hours.
- 🇧🇪Belgium fbreckx Antwerp
Oh sorry, I forgot to mention I was trying to do this with views. Is it possible as well? Don't see any formatting options there.
- 🇳🇱Netherlands johnv
In principle, any setting that you find on the node formatter, should be available in Views Field.
If not, additional information must be provided by the module - 🇧🇪Belgium fbreckx Antwerp
The problem is, as far as I can see, is that the 'Exception Day Widget' is only available at the node Form Display tab. My idea was to set it up in views (one field formatted as the regular office hours, one field only exception days), but you can't format it that way, it seems.
Rendering the entity twice directly in Twig, but with different display modes, doesn't work as well. Like so:
{{ drupal_entity('node', 68, 'office_hours') }} {{ drupal_entity('node', 68, 'exception_days') }}
As soon as you hide the days, the exception days dissapear as well.
- 🇳🇱Netherlands johnv
"My idea was to set it up in views (one field formatted as the regular office hours, one field only exception days), but you can't format it that way, it seems."
Yes that is possible.
Only problem is that there is no setting in the formatter to remove/hide the regular hours.Apart from overriding the formatter, you may change the prprocess function in office_hours_theme.inc file.
- 🇧🇪Belgium fbreckx Antwerp
Apart from overriding the formatter, you may change the prprocess function in office_hours_theme.inc file.
Sadly, that's beyond my knowledge :)
- 🇳🇱Netherlands johnv
These issues seem to have the same request:
💬 getValue() does not return all values when preprocessing Fixed
✨ Separate list of exception days? Closed: works as designed - 🇳🇱Netherlands johnv
I think you need to add the attached file to your project.
- rename the file
- check the @todo's. - 🇳🇱Netherlands johnv
from #5: "The problem is, as far as I can see, is that the 'Exception Day Widget' is only available at the node Form Display tab."
You need the Widget to maintain the data in the node, then the Formatters to use in the Views view. - 🇧🇪Belgium fbreckx Antwerp
Thanks! I've added the file to Plugin/ Field / Fieldformatter directory and renamed it to .php.
But no extra formatter is appearing (caches were cleared).Should I do anything else besides this?
- 🇳🇱Netherlands johnv
Oops, please change line 5:
* @FieldFormatter( * id = "office_hours_only_exceptions", * label = @Translation("Only exceptions"),
- Status changed to Closed: works as designed
over 1 year ago 10:58am 12 April 2023