In the field formatter, when the Day Notation option is set to a value of "none", the day-hour separator is still printed.
I can set the separator's option to an empty value, but even when doing that the item label <span> is still printed, which results in extra whitespace because of the width style that's applied to it.
These may be two separate issues
1. Not printing the separator if there's no day
2. Not printing the span if there's no label
But I figured that I would let the maintainer decide.
I would supply a patch, but to be honest I wasted a lot of time and had no success at trying to figure out where the separator is being added to the label. In my opinion a lot of this presentation logic should be moved to the template or its preprocessor function. Sorry if I'm just being clueless; I'm kind of tired this morning.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 3074361-13.office_hours.CSSissues-when-DayNotation-is-set-to-none.patch | 1.42 KB | super_romeo |
| #5 | office_hours_3074361_4_empty_label_d8.patch | 622 bytes | johnv |
Comments
Comment #2
sumit-k commentedReplicate same issue. Patch is attached. Please Check
Comment #3
sumit-k commentedComment #4
sumit-k commentedComment #5
johnvPerhaps I should implement your patch as well (there is another issue about the formatter not being 'clean').
But regarding your initial problem, please check attached patch.
Comment #6
sumit-k commentedHey johnv,
Checked with your patch working fine for me.
Comment #7
johnvIt is not shown above, but the patch in #5 is now committed.
I'll keep this open for your patch in #2.
Comment #8
sumit-k commentedHi johnv,
I am updating my patch for clean format. Please check.
Comment #9
sumit-k commentedComment #10
johnvHmm,
I implemented your patch , but did not see any effect.
I disabled COmments in the field, and set the Day notation to None.
Which forematter do you use? The Table, or the PlainText?
Comment #11
sumit-k commentedI checked with plain text
Comment #12
super_romeo commentedMy try :)
Comment #13
super_romeo commentedRerolled.
Comment #14
matija5 commentedHi, confirming patch #13 applies and that label for Plain text formatter is removed if Day notation is set to none.
Comment #15
johnvI just committed #3136825: Avoid HTML tags for empty slots and comments.
(How) does that influence this patch?
Also, the patches above are all very different. I am not sure if they all address the same issue.
Can someone clarify?
Thanks.
Comment #16
super_romeo commentedPatch stop applied because of this new lines in office-hours.html.twig file.
Comment #17
matija5 commented@johnv in related issue there are checks for slots and comments but not for label (days). This patch solves rendering of label element. But I think we just need this in template file
and we can skip changes in src/Plugin/Field/FieldType/OfficeHoursItemList.php because if we set "none" for "Day notation" then the value for $info['label'] is "".
Comment #18
super_romeo commentedI can't see source code right now, but I remember, that if we skip changes in OfficeHoursItemList.php then the value for $info['label'] will be not empty string.
But if it will be empty string, of course we can skip whose changes.
Comment #19
super_romeo commentedTested one more time. Without my patch I have:
- : 8:00-20:00Comment #20
johnvComment #21
johnvComment #22
johnvComment #23
johnvComment #25
johnvThe commit now looks like #13.
As commented above, the additional change in PHP might be superfluous, but more correct.
However, I need some CSS/Twig help from you: Why is this not applied in the TableFormatter, only in PlainTextFormatter?
For this, keeping it open.
Comment #26
super_romeo commentedBecause currently I use PlainTextFormatter only... :)
Comment #27
johnvThere is no problem in TableFormatter.