Problem:
Sometimes you don't want to show the "About text formats" link, especially if you just allow a single format on a field and therefore there is no format selector and so the link is taking up vertical space on its own.
Sometimes you don't want to show the condensed text format guidelines below a field, especially on "text, formatted" fields where the guidelines take up more space than the field input itself.
Although the main focus of this module is controlling the allowed text formats, it also seems to be an incubator for core improvements in sitebuilder control of formats UI, so it seems reasonable to include this feature.
Solution:
Create 2 new widget settings checkboxes: "Hide the help link About text formats" and "Hide text format guidelines".
The patch by @floretan from #15 works and is ready for testing & review.
Next steps:
DONE: 1. Fix the config schema in the patch
2. Review & RTBC
Comment | File | Size | Author |
---|---|---|---|
#24 | allow_to_control_if-2617982-24.patch | 3.65 KB | AdamPS |
#15 | interdiff.txt | 3.43 KB | floretan |
#15 | allow_to_control_if-2617982-15.patch | 3.52 KB | floretan |
Comments
Comment #2
floretan CreditAttribution: floretan at Wunder commentedI agree that this is a good improvement. It's not directly related to limiting formats, but the fact that these tips are useless becomes particularly visible once you limit the available formats.
Comment #3
jcnventura CreditAttribution: jcnventura at Wunder commentedAdding a related issue from back when this module lived as a core patch.
Comment #4
jonathanshawComment #5
BerdirI disagree with that title change, it's not just about that IMHO, it also about hiding the short explanation that is shown there.
Comment #6
jonathanshaw@Berdir I was trying to distinguish this issue from #2629618: Allow to hide text format help text for Text(formatted) perhaps there are angles I've overlooked?
Comment #7
BerdirAh. I'm not sure if it needs to be distinguished or if this issue is simply a duplicate. Not sure if there's a use case for controlling the link and the bullet points separately or if a single checkbox to hide both is enough?
Comment #8
jonathanshawFair question; on further thought I think there is a significant use case:
The set of bullet points that are present for only Text (formatted) take up a lot of space. Sometimes one might well wish to hide the bullets, but leave the "About text formats" link as that gives a way to access that help that is much less cluttering.
One could say that it's not an issue for this module directly - it's not related at all to controlling the allowed text formats - but as this module seems to be an incubator for core improvements in sitebuilder control of formats UI (and has this closely related issue) I thought it made sense to file here?
Comment #9
floretan CreditAttribution: floretan at Wunder commentedI don't have time to write the full implementation, but here's the basic code to hide the help text. Due to the way the formatted text widgets are structured, the code is really ugly. We should be able to get something much nicer in core.
Before this can be committed, we basically need to extend the formatted text widget with the relevant options and to read that configuration to determine what should be hidden. The tests should also be adapted.
Comment #10
jcnventura CreditAttribution: jcnventura at Wunder commentedTurning #9 into code that can be used. Since this can be applied to more than textareas, I've removed that check, and replaced with a simple check for single allowed formats.
This still needs improvements to tests and possibly some configuration at widget level whether the configuration should be hidden or not.
Comment #11
reekris CreditAttribution: reekris commentedComment #12
reekris CreditAttribution: reekris commentedComment #13
jcnventura CreditAttribution: jcnventura at Wunder commentedThe last patch no longer applies cleanly, I'm rerolling the patch and adding the requested setting to hide the help text. It only applies when only a single text format is applicable.
Comment #14
jonathanshawGreat to see some work on this. 3 points of feedback:
1. There seems to be a bug when I test it: when there is only 1 format allowed, both help link and guidelines are always hidden regardless of "Hide text format guidelines" checkbox value.
2. It seems wrong to be setting "Hide text format guidelines" on the field settings; as I think you implied before, it would seem better to have this as a widget setting not a field setting; it is a UI setting not a data storage setting.
3. "Hide text format guidelines when only a single format is allowed." I'm not clear if the intention is to hide the "About text formats" link or the text format guidelines that show up only for text(formatted) fields or both. Could you clarify?
Comment #15
floretan CreditAttribution: floretan at Wunder commentedHere's a reworked version of the patch that integrates the feedback from @jonathanjfshaw:
Leaving this as "needs review", since the config schema changes included in the patch are not valid anymore.
Comment #16
jonathanshawThat approach works perfectly for me when I test it.
Comment #17
jonathanshawComment #18
pucowanje CreditAttribution: pucowanje commentedApplied patch #15. Works perfectly for me. Thanks! Would be nice to have this in the module.
Comment #19
John Pitcairn CreditAttribution: John Pitcairn commentedPatch #15 works for me against 1.0 and 1.x-dev.
Comment #20
jonathanshawWhat action is needed to deal with #15's remark:
Comment #21
John Pitcairn CreditAttribution: John Pitcairn commented@floretan can you clarify what (if anything) needs to be done about the config shema changes?
Comment #22
leisurman CreditAttribution: leisurman commentedThis worked for me for drupal 8. Custom module file. You have to place in your field machine name
Comment #23
leisurman CreditAttribution: leisurman commentedI tried to get #9 to work but this is simular and it worked for me.
https://www.drupal.org/node/2617982#comment-11908620
Comment #24
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedPatch updated to include required schema changes
Tested free of schema errors using module config_inspector.
Comment #25
BerdirLooks good thanks, back to RTBC.
Comment #27
floretan CreditAttribution: floretan at Wunder commentedThank you!
Comment #29
Foxy-vikvik CreditAttribution: Foxy-vikvik at DevBranch commentedAfter using patches has error message