BUG: Set the summary fields of UserDefinedForm_EmailRecipient dynamically via config system

You can't dynamically expose statics; that's a no-op in 3.1
This commit is contained in:
Fred Condo 2013-04-04 12:12:37 -07:00
parent ed46cfdb08
commit f0f9ea702c

View File

@ -74,11 +74,16 @@ class UserDefinedForm extends Page {
$editor->setRows(3); $editor->setRows(3);
$label->addExtraClass('left'); $label->addExtraClass('left');
UserDefinedForm_EmailRecipient::set_summary_fields(array( // Set the summary fields of UserDefinedForm_EmailRecipient dynamically via config system
Config::inst()->update(
'UserDefinedForm_EmailRecipient',
'summary_fields',
array(
'EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'), 'EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'),
'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'), 'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'),
'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From') 'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From'),
)); )
);
// who do we email on submission // who do we email on submission
$emailRecipients = new GridField("EmailRecipients", _t('UserDefinedForm.EMAILRECIPIENTS', 'Email Recipients'), $this->EmailRecipients(), GridFieldConfig_RecordEditor::create(10)); $emailRecipients = new GridField("EmailRecipients", _t('UserDefinedForm.EMAILRECIPIENTS', 'Email Recipients'), $this->EmailRecipients(), GridFieldConfig_RecordEditor::create(10));
@ -1034,15 +1039,6 @@ class UserDefinedForm_EmailRecipient extends DataObject {
private static $summary_fields = array(); private static $summary_fields = array();
/**
* Expose the summary_fields static
*
* @param array $fields
*/
public static function set_summary_fields($fields) {
self::$summary_fields = $fields;
}
/** /**
* @return FieldList * @return FieldList
*/ */