mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 15:05:42 +00:00
Merge pull request #621 from creative-commoners/pulls/4.2/fix-submissions-gridfield-state
FIX Pass submissions GridFieldConfig to GridField constructor to avoid error in state
This commit is contained in:
commit
08b0a74124
@ -118,14 +118,13 @@ class UserDefinedForm extends Page
|
|||||||
/**
|
/**
|
||||||
* @return FieldList
|
* @return FieldList
|
||||||
*/
|
*/
|
||||||
public function getCMSFields()
|
public function getCMSFields()
|
||||||
{
|
{
|
||||||
Requirements::css(USERFORMS_DIR . '/css/UserForm_cms.css');
|
Requirements::css(USERFORMS_DIR . '/css/UserForm_cms.css');
|
||||||
|
|
||||||
$self = $this;
|
$self = $this;
|
||||||
|
|
||||||
$this->beforeUpdateCMSFields(function ($fields) use ($self) {
|
|
||||||
|
|
||||||
|
$this->beforeUpdateCMSFields(function ($fields) use ($self) {
|
||||||
// define tabs
|
// define tabs
|
||||||
$fields->findOrMakeTab('Root.FormOptions', _t('UserDefinedForm.CONFIGURATION', 'Configuration'));
|
$fields->findOrMakeTab('Root.FormOptions', _t('UserDefinedForm.CONFIGURATION', 'Configuration'));
|
||||||
$fields->findOrMakeTab('Root.Recipients', _t('UserDefinedForm.RECIPIENTS', 'Recipients'));
|
$fields->findOrMakeTab('Root.Recipients', _t('UserDefinedForm.RECIPIENTS', 'Recipients'));
|
||||||
@ -167,12 +166,6 @@ class UserDefinedForm extends Page
|
|||||||
|
|
||||||
|
|
||||||
// view the submissions
|
// view the submissions
|
||||||
$submissions = new GridField(
|
|
||||||
'Submissions',
|
|
||||||
_t('UserDefinedForm.SUBMISSIONS', 'Submissions'),
|
|
||||||
$self->Submissions()->sort('Created', 'DESC')
|
|
||||||
);
|
|
||||||
|
|
||||||
// make sure a numeric not a empty string is checked against this int column for SQL server
|
// make sure a numeric not a empty string is checked against this int column for SQL server
|
||||||
$parentID = (!empty($self->ID)) ? (int) $self->ID : 0;
|
$parentID = (!empty($self->ID)) ? (int) $self->ID : 0;
|
||||||
|
|
||||||
@ -229,23 +222,33 @@ SQL;
|
|||||||
$export->setCsvHasHeader(true);
|
$export->setCsvHasHeader(true);
|
||||||
$export->setExportColumns($columns);
|
$export->setExportColumns($columns);
|
||||||
|
|
||||||
$submissions->setConfig($config);
|
$submissions = GridField::create(
|
||||||
|
'Submissions',
|
||||||
|
_t('UserDefinedForm.SUBMISSIONS', 'Submissions'),
|
||||||
|
$self->Submissions()->sort('Created', 'DESC'),
|
||||||
|
$config
|
||||||
|
);
|
||||||
$fields->addFieldToTab('Root.Submissions', $submissions);
|
$fields->addFieldToTab('Root.Submissions', $submissions);
|
||||||
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('DisableSaveSubmissions', _t('UserDefinedForm.SAVESUBMISSIONS', 'Disable Saving Submissions to Server')));
|
$fields->addFieldToTab(
|
||||||
|
'Root.FormOptions',
|
||||||
|
CheckboxField::create(
|
||||||
|
'DisableSaveSubmissions',
|
||||||
|
_t('UserDefinedForm.SAVESUBMISSIONS', 'Disable Saving Submissions to Server')
|
||||||
|
)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
|
|
||||||
if ($this->EmailRecipients()->Count() == 0 && static::config()->recipients_warning_enabled) {
|
if ($this->EmailRecipients()->Count() == 0 && static::config()->recipients_warning_enabled) {
|
||||||
$fields->addFieldToTab("Root.Main", new LiteralField("EmailRecipientsWarning",
|
$fields->addFieldToTab("Root.Main", new LiteralField("EmailRecipientsWarning",
|
||||||
"<p class=\"message warning\">" . _t("UserDefinedForm.NORECIPIENTS",
|
"<p class=\"message warning\">" . _t("UserDefinedForm.NORECIPIENTS",
|
||||||
"Warning: You have not configured any recipients. Form submissions may be missed.")
|
"Warning: You have not configured any recipients. Form submissions may be missed.")
|
||||||
. "</p>"), "Title");
|
. "</p>"), "Title");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow overriding the EmailRecipients on a {@link DataExtension}
|
* Allow overriding the EmailRecipients on a {@link DataExtension}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user