Offer the possibility to override internal formatter objects from plugins
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user