Problem/Motivation
Content editors may find it confusing to see the "Save and Clear Cloudflare Cache" button, if they are not aware of "Cloudflare" or "caching". Maybe this could be addressed by documentation and training, but I wonder if the maintainers are interested having a config option "Replace default save button with Clear Cloudflare Cache button", which, if enabled, will replace the save button and style the cloudflare_node_cc button as primary with the default text, Save.
I think this feature can reduce stress of content editors without altering the interface or slowing down the site.
This feature should be off by default so site builders will not be surprised about the missing button.
Steps to reproduce
- Edit a node.
- Locate the Save button.
- See a primary Save, and a secondary "Save and clear cloudflare cache".
Proposed resolution
- Add a config item "Replace default save button with cloudflare node cache clear button"
- If this config item exists and set to true, then Remove the default submit button, change the style to primary, and change the text to translated "Save".
- Else, output the cloudflare node cache clear button alongside the save button (no change).
Remaining tasks
Implement the change.- Collect feedback on feature
- Collect feedback on implementation
User interface changes
Disappearance of the cloudflare node cache clear button if the feature is turned on by the admin.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | cloudflare_node_cc-n3494694-13.patch | 4.04 KB | damienmckenna |
Issue fork cloudflare_node_cc-3494694
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
hktang commentedI added pull request and would appreciate your review. Thank you!
Comment #4
hktang commentedComment #5
hktang commentedComment #8
luukyb commentedHi @hktang,
Great meeting you at DrupalCon Nara!
This is great, I think best would be to have the checkbox to activate/deactivate this functionnality and when checked:
So the two options are offered to the user, but the default becomes the renamed purge button. This avoid confusion to most users and enable the new feature by default. This would be my suggestion.
Thanks!
Comment #9
damienmckennaI think this could work really well alongside #3479228: Add disable option and confirm option as safeguards, so that you could use Config Split or settings.php hardcoding to control which environments have Cloudflare enabled using #3479228, then use this change to make the "save" button always clear the caches on environments where CF is enabled.
Comment #10
damienmckennaContrary to #8, could this actually go a step further and just add an extra submit handler on $form['actions']['submit'], rather than as part of $form['actions']['cf_purge'], if the option is enabled? That way it would end up something like this:
Comment #11
damienmckennaAlso, #3507723: Use configuration for storing configuration might be useful too.
Comment #13
damienmckennaA version of MR 10 that works on top of #3507723: Use configuration for storing configuration.
Comment #14
damienmckennaComment #15
damienmckennaComment #17
damienmckennaCommitted. Thank you.