diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-12-20 20:06:39 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-12-20 20:06:39 -0500 |
commit | ae708a712a5dd932c01e734f8450b899b1407a70 (patch) | |
tree | 348c01ad849fbeeee0fba74118b4536af4119333 /app/Formatter | |
parent | a957195952e2c93177628ab07936d783da1388c3 (diff) |
Offer the possibility to override internal formatter objects from plugins
Diffstat (limited to 'app/Formatter')
-rw-r--r-- | app/Formatter/BoardColumnFormatter.php | 2 | ||||
-rw-r--r-- | app/Formatter/BoardFormatter.php | 2 | ||||
-rw-r--r-- | app/Formatter/BoardSwimlaneFormatter.php | 2 | ||||
-rw-r--r-- | app/Formatter/GroupAutoCompleteFormatter.php | 22 | ||||
-rw-r--r-- | app/Formatter/UserAutoCompleteFormatter.php | 2 |
5 files changed, 10 insertions, 20 deletions
diff --git a/app/Formatter/BoardColumnFormatter.php b/app/Formatter/BoardColumnFormatter.php index 85d31b5c..0d59f54e 100644 --- a/app/Formatter/BoardColumnFormatter.php +++ b/app/Formatter/BoardColumnFormatter.php @@ -79,7 +79,7 @@ class BoardColumnFormatter extends BaseFormatter implements FormatterInterface { foreach ($this->columns as &$column) { $column['id'] = (int) $column['id']; - $column['tasks'] = BoardTaskFormatter::getInstance($this->container) + $column['tasks'] = $this->boardTaskFormatter ->withTasks($this->tasks) ->withTags($this->tags) ->withSwimlaneId($this->swimlaneId) diff --git a/app/Formatter/BoardFormatter.php b/app/Formatter/BoardFormatter.php index df443a52..3f47bfa9 100644 --- a/app/Formatter/BoardFormatter.php +++ b/app/Formatter/BoardFormatter.php @@ -59,7 +59,7 @@ class BoardFormatter extends BaseFormatter implements FormatterInterface $task_ids = array_column($tasks, 'id'); $tags = $this->taskTagModel->getTagsByTasks($task_ids); - return BoardSwimlaneFormatter::getInstance($this->container) + return $this->boardSwimlaneFormatter ->withSwimlanes($swimlanes) ->withColumns($columns) ->withTasks($tasks) diff --git a/app/Formatter/BoardSwimlaneFormatter.php b/app/Formatter/BoardSwimlaneFormatter.php index ce67c8a8..18db259d 100644 --- a/app/Formatter/BoardSwimlaneFormatter.php +++ b/app/Formatter/BoardSwimlaneFormatter.php @@ -82,7 +82,7 @@ class BoardSwimlaneFormatter extends BaseFormatter implements FormatterInterface foreach ($this->swimlanes as &$swimlane) { $swimlane['id'] = (int) $swimlane['id']; - $swimlane['columns'] = BoardColumnFormatter::getInstance($this->container) + $swimlane['columns'] = $this->boardColumnFormatter ->withSwimlaneId($swimlane['id']) ->withColumns($this->columns) ->withTasks($this->tasks) diff --git a/app/Formatter/GroupAutoCompleteFormatter.php b/app/Formatter/GroupAutoCompleteFormatter.php index 4d552886..d811de7f 100644 --- a/app/Formatter/GroupAutoCompleteFormatter.php +++ b/app/Formatter/GroupAutoCompleteFormatter.php @@ -12,36 +12,26 @@ use PicoDb\Table; * @package formatter * @author Frederic Guillot */ -class GroupAutoCompleteFormatter implements FormatterInterface +class GroupAutoCompleteFormatter extends BaseFormatter implements FormatterInterface { /** * Groups found * - * @access private + * @access protected * @var GroupProviderInterface[] */ - private $groups; + protected $groups; /** - * Format groups for the ajax auto-completion + * Set groups * * @access public * @param GroupProviderInterface[] $groups + * @return $this */ - public function __construct(array $groups) + public function withGroups(array $groups) { $this->groups = $groups; - } - - /** - * Set query - * - * @access public - * @param Table $query - * @return FormatterInterface - */ - public function withQuery(Table $query) - { return $this; } diff --git a/app/Formatter/UserAutoCompleteFormatter.php b/app/Formatter/UserAutoCompleteFormatter.php index cd23a2a4..32a83608 100644 --- a/app/Formatter/UserAutoCompleteFormatter.php +++ b/app/Formatter/UserAutoCompleteFormatter.php @@ -14,7 +14,7 @@ use Kanboard\Core\Filter\FormatterInterface; class UserAutoCompleteFormatter extends BaseFormatter implements FormatterInterface { /** - * Format the tasks for the ajax autocompletion + * Format the tasks for the ajax auto-completion * * @access public * @return array |