ServiceController: beforeHandlingAddRequest hook

This commit is contained in:
Thomas Gelf 2016-03-29 19:32:50 +02:00
parent c1185106fa
commit 078e46df60
2 changed files with 20 additions and 0 deletions

View File

@ -79,6 +79,20 @@ class ServiceController extends ObjectController
}
}
protected function beforeHandlingAddRequest($form)
{
if ($this->apply) {
if (!$form->hasBeenSent()) {
$form->populate(array(
'imports' => $this->apply->object_name,
'object_name' => $this->apply->object_name,
'object_type' => 'apply',
));
$form->getObject()->object_type = 'apply';
}
}
}
public function editAction()
{
parent::editAction();

View File

@ -185,10 +185,16 @@ abstract class ObjectController extends ActionController
ucfirst($ltype)
);
$this->beforeHandlingAddRequest($form);
$form->handleRequest();
$this->setViewScript('object/form');
}
protected function beforeHandlingAddRequest($form)
{
}
public function cloneAction()
{
$type = $this->getType();