mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
ENHANCEMENT Display and export the submitter email
This commit is contained in:
parent
7e63094bb1
commit
5ad7767ead
@ -232,6 +232,7 @@ SQL;
|
|||||||
|
|
||||||
// attach every column to the print view form
|
// attach every column to the print view form
|
||||||
$columns['Created'] = 'Created';
|
$columns['Created'] = 'Created';
|
||||||
|
$columns['SubmittedBy.Email'] = 'Submitter';
|
||||||
$filter->setColumns($columns);
|
$filter->setColumns($columns);
|
||||||
|
|
||||||
// print configuration
|
// print configuration
|
||||||
|
@ -57,7 +57,23 @@ class SubmittedForm extends DataObject
|
|||||||
|
|
||||||
$this->beforeUpdateCMSFields(function ($fields) use ($self) {
|
$this->beforeUpdateCMSFields(function ($fields) use ($self) {
|
||||||
$fields->removeByName('Values');
|
$fields->removeByName('Values');
|
||||||
$fields->dataFieldByName('SubmittedByID')->setDisabled(true);
|
|
||||||
|
//check to ensure there is a Member to extract an Email from else null value
|
||||||
|
if($self->SubmittedBy() && $self->SubmittedBy()->exists()){
|
||||||
|
$submitter = $self->SubmittedBy()->Email;
|
||||||
|
} else {
|
||||||
|
$submitter = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//replace scaffolded field with readonly submitter
|
||||||
|
$fields->replaceField(
|
||||||
|
'SubmittedByID',
|
||||||
|
ReadonlyField::create(
|
||||||
|
'Submitter',
|
||||||
|
'Submitter',
|
||||||
|
$submitter
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$values = new GridField(
|
$values = new GridField(
|
||||||
'Values',
|
'Values',
|
||||||
|
Loading…
Reference in New Issue
Block a user