mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
FIX UserFormFieldEditorExtension::onAfterDuplicate accepts the correct parameters from DataObject::duplicate
This commit is contained in:
parent
1bd0b0c138
commit
f25f1e9c1b
@ -213,19 +213,19 @@ class UserFormFieldEditorExtension extends DataExtension
|
|||||||
* When duplicating a UserDefinedForm, duplicate all of its fields and display rules
|
* When duplicating a UserDefinedForm, duplicate all of its fields and display rules
|
||||||
*
|
*
|
||||||
* @see DataObject::duplicate
|
* @see DataObject::duplicate
|
||||||
* @param DataObject $newPage
|
* @param DataObject $oldPage
|
||||||
* @param bool $doWrite
|
* @param bool $doWrite
|
||||||
* @param string $manyMany
|
* @param string $manyMany
|
||||||
* @return DataObject
|
* @return DataObject
|
||||||
*/
|
*/
|
||||||
public function onAfterDuplicate($newPage, $doWrite, $manyMany)
|
public function onAfterDuplicate($oldPage, $doWrite, $manyMany)
|
||||||
{
|
{
|
||||||
// List of EditableFieldGroups, where the key of the array is the ID of the old end group
|
// List of EditableFieldGroups, where the key of the array is the ID of the old end group
|
||||||
$fieldGroups = [];
|
$fieldGroups = [];
|
||||||
foreach ($this->owner->Fields() as $field) {
|
foreach ($oldPage->Fields() as $field) {
|
||||||
$newField = $field->duplicate(false);
|
$newField = $field->duplicate(false);
|
||||||
$newField->ParentID = $newPage->ID;
|
$newField->ParentID = $this->owner->ID;
|
||||||
$newField->ParentClass = $newPage->ClassName;
|
$newField->ParentClass = $this->owner->ClassName;
|
||||||
$newField->Version = 0;
|
$newField->Version = 0;
|
||||||
$newField->write();
|
$newField->write();
|
||||||
|
|
||||||
@ -248,8 +248,6 @@ class UserFormFieldEditorExtension extends DataExtension
|
|||||||
$newRule->write();
|
$newRule->write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $newPage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user