Merge pull request #74 from briceburg/multiclass-setItemRequestClass

allow specification of GridFieldAddNewMultiClass handler
This commit is contained in:
Marcus 2014-12-08 08:44:55 +11:00
commit 187fa61d7a

View File

@ -17,6 +17,11 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
private $classes;
/**
* @var String
*/
protected $itemRequestClass = 'GridFieldAddNewMultiClassHandler';
/**
* @param string $fragment the fragment to render the button in
*/
@ -129,7 +134,7 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
throw new SS_HTTPResponse_Exception(400);
}
$handler = new GridFieldAddNewMultiClassHandler(
$handler = Object::create($this->itemRequestClass,
$grid, $component, new $class(), $grid->getForm()->getController(), 'add-multi-class'
);
$handler->setTemplate($component->getTemplate());
@ -173,4 +178,8 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
);
}
public function setItemRequestClass($class) {
$this->itemRequestClass = $class;
return $this;
}
}