mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
fall back to CMSMain rather than LeftAndMain to getFormParent correctly
This commit is contained in:
parent
46460c0e7c
commit
579028982c
@ -61,7 +61,7 @@ class EmailRecipient extends DataObject
|
|||||||
];
|
];
|
||||||
|
|
||||||
private static $has_one = [
|
private static $has_one = [
|
||||||
'Form' => DataObject::class,
|
'Form' => UserDefinedForm::class,
|
||||||
'SendEmailFromField' => EditableFormField::class,
|
'SendEmailFromField' => EditableFormField::class,
|
||||||
'SendEmailToField' => EditableFormField::class,
|
'SendEmailToField' => EditableFormField::class,
|
||||||
'SendEmailSubjectField' => EditableFormField::class
|
'SendEmailSubjectField' => EditableFormField::class
|
||||||
@ -125,12 +125,12 @@ class EmailRecipient extends DataObject
|
|||||||
/**
|
/**
|
||||||
* Get instance of UserDefinedForm when editing in getCMSFields
|
* Get instance of UserDefinedForm when editing in getCMSFields
|
||||||
*
|
*
|
||||||
* @return UserDefinedFrom
|
* @return UserDefinedForm
|
||||||
*/
|
*/
|
||||||
protected function getFormParent()
|
protected function getFormParent()
|
||||||
{
|
{
|
||||||
// LeftAndMain::sessionNamespace is protected. @todo replace this with a non-deprecated equivalent.
|
// LeftAndMain::sessionNamespace is protected. @todo replace this with a non-deprecated equivalent.
|
||||||
$sessionNamespace = $this->config()->get('session_namespace') ?: LeftAndMain::class;
|
$sessionNamespace = $this->config()->get('session_namespace') ?: CMSMain::class;
|
||||||
|
|
||||||
$formID = $this->FormID
|
$formID = $this->FormID
|
||||||
? $this->FormID
|
? $this->FormID
|
||||||
@ -448,16 +448,15 @@ class EmailRecipient extends DataObject
|
|||||||
|
|
||||||
public function canView($member = null)
|
public function canView($member = null)
|
||||||
{
|
{
|
||||||
if ($form = $this->Form()) {
|
if ($form = $this->getFormParent()) {
|
||||||
return $form->canView($member);
|
return $form->canView($member);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::canView($member);
|
return parent::canView($member);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canEdit($member = null)
|
public function canEdit($member = null)
|
||||||
{
|
{
|
||||||
if ($form = $this->Form()) {
|
if ($form = $this->getFormParent()) {
|
||||||
return $form->canEdit($member);
|
return $form->canEdit($member);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user