-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Archiving a DataObject calls the validator #2760
Comments
Yeah, that's been like that for some time now and we had users complaining about it as well. Since our validation was usually simple we asked them to populate those required fields and then archive it. |
There’s a method in |
Already tried that... seems that when the archive action kicks in the |
silverstripe-cms/code/Controllers/CMSMain.php Lines 1379 to 1388 in de8d763
CMSMain does this for SiteTree (or, more specifically, does it for the edit form most typically used for SiteTree ), which is why this doesn't happen for pages.
You should be able to work around this by adding the following extension to class GridFieldValidationExcemptExtension extends Extension
{
public function updateItemEditForm(Form $form): void
{
$form->setValidationExemptActions([
'doArchive',
// You probably want to also add other actions like delete, restore, etc
]);
}
} Ideally this will be done in core directly in |
Affected Version
4.11.4
Description
The
getCMSValidator
method of aDataObject
does not respect thedoArchive
action.Steps to Reproduce
getCMSValidator
method to aDataObject
.Archive a
DataObject
(record) where the required field is empty.This will validate the
DataObject
which is not desirable.The text was updated successfully, but these errors were encountered: