cms
cms copied to clipboard
[5.x] Add Nav & Collection Tree Saving and Deleting events
Someone was looking for NavTreeSaving and CollectionTreeSaving in discussions earlier: https://github.com/statamic/cms/discussions/10618
This PR adds them, as well as adding *Deleting events too.
Closes statamic/ideas#1207.
i think you are missing the changes to handle the false state.
// CollectionTreeController.php
$saved = $tree->tree($contents)->save();
return [
'saved' => $saved,
];
something like:
// PageTree.vue
if (! response.data.saved) {
return this.$toast.error(__(`Couldn't save tree`));
}
and return true at the end of the save function in the Tree.php
same changes for the delete part.
changes looks good :)
no idea but is this change also needed for delete? And also for NavTree to work correctly with NavTree Events?
Deleting in the CP only happens by deleting the whole nav, so it shouldn't need UI.
Do you really need the Deleting events at the moment?
This can prevent the tree from being deleted, but that doesn't stop the nav from being deleted.
Nope. Dump them if they are causingproblems.