summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-02-01 19:27:28 -0500
committerFrederic Guillot <fred@kanboard.net>2016-02-01 19:27:28 -0500
commiteaf2b0949be390dea6ec8b035773c7061eac4531 (patch)
treefa3bdb96c79dc4d0b93f057ebd03a4f9e890e6c6 /app
parentb5e1deeaa84c792b1a0523d1f9038955e7745025 (diff)
Add new merge hook to override default form values
Diffstat (limited to 'app')
-rw-r--r--app/Controller/Gantt.php14
-rw-r--r--app/Controller/Taskcreation.php2
-rw-r--r--app/Controller/Taskmodification.php1
3 files changed, 12 insertions, 5 deletions
diff --git a/app/Controller/Gantt.php b/app/Controller/Gantt.php
index b1dc2b7e..2d1edc08 100644
--- a/app/Controller/Gantt.php
+++ b/app/Controller/Gantt.php
@@ -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']),
diff --git a/app/Controller/Taskcreation.php b/app/Controller/Taskcreation.php
index 396d5f6f..6f5253eb 100644
--- a/app/Controller/Taskcreation.php
+++ b/app/Controller/Taskcreation.php
@@ -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(
diff --git a/app/Controller/Taskmodification.php b/app/Controller/Taskmodification.php
index dc368390..cae1d8ee 100644
--- a/app/Controller/Taskmodification.php
+++ b/app/Controller/Taskmodification.php
@@ -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'));