MINOR Re-instating Member_Validator in SecurityAdmin->RootForm() and Groups->getCMSFields() with new GridField implementation

This commit is contained in:
Ingo Schommer 2012-03-05 17:06:07 +01:00
parent 40abab8aec
commit f9f659672a
2 changed files with 8 additions and 11 deletions

View File

@ -82,14 +82,14 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
}
/**
* The fields for individual groups will be created through {@link Group->getCMSFields()}.
*
* @return FieldList
*/
function RootForm() {
$config = new GridFieldConfig_Base(25);
$config->addComponent(new GridFieldAction_Edit());
$config->addComponent(new GridFieldAction_Delete());
$config->addComponent(new GridFieldPopupForms());
$config = new GridFieldConfig_RecordEditor();
$config->addComponent(new GridFieldExporter());
$config->getComponentByType('GridFieldPopupForms')->setValidator(new Member_Validator());
$memberList = new GridField('Members', 'All members', DataList::create('Member'), $config);
$memberList->addExtraClass("members_grid");

View File

@ -55,22 +55,19 @@ class Group extends DataObject {
/**
* Caution: Only call on instances, not through a singleton.
* The "root group" fields will be created through {@link SecurityAdmin->RootForm()}.
*
* @return FieldList
*/
public function getCMSFields() {
Requirements::javascript(SAPPHIRE_DIR . '/javascript/PermissionCheckboxSetField.js');
$config = new GridFieldConfig();
$config->addComponent(new GridFieldTitle());
$components = $configs->getComponents();
foreach($components as $component) $config->addComponent($component);
$config = new GridFieldConfig_RelationEditor('FirstName', 20);
$config = new GridFieldConfig_RelationEditor(20);
$config = new GridFieldConfig_RelationEditor();
$config->addComponents(new GridFieldExporter());
$config->getComponentByType('GridFieldRelationAdd')
->setResultsFormat('$Title ($Email)')->setSearchFields(array('FirstName', 'Surname', 'Email'));
$config->getComponentByType('GridFieldPopupForms')->setValidator(new Member_Validator());
$memberList = new GridField('Members','Members', $this->Members(), $config);
$memberList->addExtraClass('members_grid');