FIX: run member CMS validator when editing via groups (fixes #9… (#9255)

FIX: run member CMS validator when editing via groups (fixes #9184)
This commit is contained in:
Guy Marriott 2019-09-23 10:28:38 -07:00 committed by GitHub
commit 190b2f2842
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,7 +96,7 @@ class Group extends DataObject
return $doSet;
}
private function getDecodedBreadcrumbs()
{
$list = Group::get()->exclude('ID', $this->ID);
@ -166,10 +166,10 @@ class Group extends DataObject
/** @var GridFieldDetailForm $detailForm */
$detailForm = $config->getComponentByType(GridFieldDetailForm::class);
$detailForm
->setValidator(Member_Validator::create())
->setItemEditFormCallback(function ($form) use ($group) {
/** @var Form $form */
$record = $form->getRecord();
$form->setValidator($record->getValidator());
$groupsField = $form->Fields()->dataFieldByName('DirectGroups');
if ($groupsField) {
// If new records are created in a group context,
@ -332,7 +332,7 @@ class Group extends DataObject
// Now set all children groups as a new foreign key
$familyIDs = $this->collateFamilyIDs();
$result = $result->forForeignID($familyIDs);
return $result->where($filter);
}