Closed PWaddict closed 1 year ago
Thanks, I have pushed a fix for this issue.
@ryancramerdesign I like what you did where the repeater items with missing values are opened but there is still one problem that needs to be fixed: If a page is already published and the editor add a new repeater item with missing required values when the page is saved it doesn't get unpublished.
@ryancramerdesign I just test it again and it seems to be working properly cause now the page is getting unpublished as it should. I will do more testings and report back.
@ryancramerdesign I found why it doesn't work sometimes. The page doesn't get unpublished if the repeater item is "New". Check the screenshot.
@ryancramerdesign Bumping this for your consideration.
@PWaddict, is this still an issue? There have been some changes in repeaters, so please check with the latest dev.
@matjazpotocnik @ryancramerdesign
The issue still exists in 3.0.199. The page doesn't get unpublished if the repeater item is "New". Here is the screenshot:
@PWaddict @matjazpotocnik @netcarver The reason for this is that the repeater item with label "New" is not a published repeater item, and thus not contributing to the live page's data. A repeater item won't publish until its own requirements are met. So there would be no reason to unpublish the owning page for a missing requirement on an unpublished repeater item, as the front-end page would be the same either way.
But if a repeater item is already published, and you go and make its title blank, then that's going to affect the live page data, and thus your unpublish rule would apply for the owning page at that point.
@ryancramerdesign maybe the best solution for this "new" repeater item is to auto delete if it's not used at all?
@PWaddict I'd prefer not to auto-delete anything since these are technically pages in the system. Plus I'm not sure we can really tell what the intention of the user is, probably best to leave it to them to decide.
Short description of the issue
Having "Required field action" set to "Unpublish the page" on a specific template and also having a repeater field on that template with at least 1 empty required repeater item field the page doesn't unpublish.
Optional: Suggestion for a possible fix
I'm currently using the following hook as a temp fix to auto unpublish the page when there are empty required repeater items on a specific repeater and template.
I've also changed "Repeater item visibility in editor" to "Items always open" so the site editor will easily see which repeater items needs to edit. Of course it would be better to only display repeater items as opened the ones with the missing required values but I don't know how to do that.
Setup/Environment