Add new merge hook to override default form values

This commit is contained in:
Frederic Guillot
2016-02-01 19:27:28 -05:00
parent b5e1deeaa8
commit eaf2b0949b
4 changed files with 32 additions and 5 deletions

View File

@@ -101,14 +101,18 @@ class Gantt extends Base
{
$project = $this->getProject();
$values = $values + array(
'project_id' => $project['id'],
'column_id' => $this->board->getFirstColumn($project['id']),
'position' => 1
);
$values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values));
$this->response->html($this->template->render('gantt/task_creation', array(
'project' => $project,
'errors' => $errors,
'values' => $values + array(
'project_id' => $project['id'],
'column_id' => $this->board->getFirstColumn($project['id']),
'position' => 1
),
'values' => $values,
'users_list' => $this->projectUserRole->getAssignableUsersList($project['id'], true, false, true),
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($project['id']),

View File

@@ -27,6 +27,8 @@ class Taskcreation extends Base
'color_id' => $this->color->getDefaultColor(),
'owner_id' => $this->userSession->getId(),
);
$values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values));
}
$this->response->html($this->template->render('task_creation/form', array(

View File

@@ -100,6 +100,7 @@ class Taskmodification extends Base
if (empty($values)) {
$values = $task;
$values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values));
}
$this->dateParser->format($values, array('date_due'));