Skip to content

Commit

Permalink
MINOR Re-instating Member_Validator in SecurityAdmin->RootForm() and …
Browse files Browse the repository at this point in the history
…Groups->getCMSFields() with new GridField implementation
  • Loading branch information
chillu committed Mar 5, 2012
1 parent 40abab8 commit f9f6596
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
8 changes: 4 additions & 4 deletions admin/code/SecurityAdmin.php
Expand Up @@ -82,14 +82,14 @@ public function getEditForm($id = null, $fields = null) {
}

/**
* 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");

Expand Down
11 changes: 4 additions & 7 deletions security/Group.php
Expand Up @@ -55,22 +55,19 @@ function getAllChildren() {

/**
* 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');

Expand Down

0 comments on commit f9f6596

Please sign in to comment.