diff options
Diffstat (limited to 'app/Controller/SubtaskController.php')
-rw-r--r-- | app/Controller/SubtaskController.php | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/app/Controller/SubtaskController.php b/app/Controller/SubtaskController.php index 93dab5cd..134b057e 100644 --- a/app/Controller/SubtaskController.php +++ b/app/Controller/SubtaskController.php @@ -27,10 +27,7 @@ class SubtaskController extends BaseController $task = $this->getTask(); if (empty($values)) { - $values = array( - 'task_id' => $task['id'], - 'another_subtask' => $this->request->getIntegerParam('another_subtask', 0) - ); + $values = $this->prepareValues($task); } $this->response->html($this->template->render('subtask/create', array( @@ -40,6 +37,24 @@ class SubtaskController extends BaseController 'task' => $task, ))); } + + /** + * Prepare form values + * + * @access protected + * @param array $task + * @return array + */ + protected function prepareValues(array $task) + { + $values = array( + 'task_id' => $task['id'], + 'another_subtask' => $this->request->getIntegerParam('another_subtask', 0) + ); + + $values = $this->hook->merge('controller:subtask:form:default', $values, array('default_values' => $values)); + return $values; + } /** * Validation and creation @@ -168,7 +183,7 @@ class SubtaskController extends BaseController $values = $this->request->getJson(); if (! empty($values) && $this->helper->user->hasProjectAccess('SubtaskController', 'movePosition', $project_id)) { - $result = $this->subtaskModel->changePosition($task_id, $values['subtask_id'], $values['position']); + $result = $this->subtaskPositionModel->changePosition($task_id, $values['subtask_id'], $values['position']); $this->response->json(array('result' => $result)); } else { throw new AccessForbiddenException(); |