summaryrefslogtreecommitdiff
path: root/app/Formatter
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-02-26 15:18:49 -0500
committerFrederic Guillot <fred@kanboard.net>2017-02-26 15:18:49 -0500
commit4a87fb34ba0a88303282923a73a8fef83d7aada3 (patch)
tree885aab3106a89130fea3aa83e4fe97526a37e43d /app/Formatter
parent9bcf97a6c9110afd62b542b92d07d27f945eda96 (diff)
Display tags in task list view
Diffstat (limited to 'app/Formatter')
-rw-r--r--app/Formatter/TaskListFormatter.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/Formatter/TaskListFormatter.php b/app/Formatter/TaskListFormatter.php
new file mode 100644
index 00000000..01fbbae0
--- /dev/null
+++ b/app/Formatter/TaskListFormatter.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Kanboard\Formatter;
+
+use Kanboard\Core\Filter\FormatterInterface;
+
+/**
+ * Class TaskListFormatter
+ *
+ * @package Kanboard\Formatter
+ * @author Frederic Guillot
+ */
+class TaskListFormatter extends BaseFormatter implements FormatterInterface
+{
+ /**
+ * Apply formatter
+ *
+ * @access public
+ * @return mixed
+ */
+ public function format()
+ {
+ $tasks = $this->query->findAll();
+ $taskIds = array_column($tasks, 'id');
+ $tags = $this->taskTagModel->getTagsByTasks($taskIds);
+ array_merge_relation($tasks, $tags, 'tags', 'id');
+
+ return $tasks;
+ }
+}