Problem/Motivation
We often run into issues where users delete their homepage, or they unpublish it. Unpublishing typically takes longer to notice, because it's only anonymous visitors that would notice the effect as they are met with an access denied message when trying to view the unpublished homepage.
Steps to reproduce
Proposed resolution
This is trickier than preventing a node from being deleted. One option is to add form validation to the node form and the views bulk operation form that's used on the main content dashboard for bulk unpublishing, but of course there are other ways a node could be unpublished.
I wonder if a central way to do this would be with an entity validator.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork prevent_homepage_deletion-3389999
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 #2
joshahubbers commentedThis is a tricky one indeed. It is not very hard to intercept the form and prevent the published setting being set to false, but how will this behave in automated workflows? I have to think about this a little.
Comment #3
bkosborneWe ended up doing this:
This removes the ability to unpublish the page from the UI, like when editing a node (the publish checkbox is removed) or using bulk actions on the main content list view.
Comment #4
joshahubbers commentedHm, nice, I will have a look at inserting it in the module and write some tests for it.
Comment #5
joshahubbers commentedDid you use this in combination with workflows?
Comment #6
bkosborneI haven't tested it with workflows, but I think it wouldn't work with content moderation.
Comment #7
joshahubbers commentedHm, I did add your suggestion to the module, but accidently committed it in the dev branch in stead of in the issue fork. If you want to test the implementation in the dev-branch, it would be great...
Comment #8
joshahubbers commented