Add ProjectApiFormatter
This commit is contained in:
22
Formatter/ProjectApiFormatter.php
Normal file
22
Formatter/ProjectApiFormatter.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Kanboard\Plugin\Calendar\Formatter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ProjectApiFormatter
|
||||||
|
*
|
||||||
|
* @package Kanboard\Plugin\Calendar\Formatter
|
||||||
|
*/
|
||||||
|
class ProjectApiFormatter extends \Kanboard\Formatter\ProjectApiFormatter
|
||||||
|
{
|
||||||
|
public function format()
|
||||||
|
{
|
||||||
|
$project = parent::format();
|
||||||
|
|
||||||
|
if (! empty($project)) {
|
||||||
|
$project['url']['calendar'] = $this->helper->url->to('CalendarController', 'project', array('project_id' => $project['id'], 'plugin' => 'Calendar'), '', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $project;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ namespace Kanboard\Plugin\Calendar;
|
|||||||
|
|
||||||
use Kanboard\Core\Plugin\Base;
|
use Kanboard\Core\Plugin\Base;
|
||||||
use Kanboard\Core\Translator;
|
use Kanboard\Core\Translator;
|
||||||
|
use Kanboard\Plugin\Calendar\Formatter\ProjectApiFormatter;
|
||||||
use Kanboard\Plugin\Calendar\Formatter\TaskCalendarFormatter;
|
use Kanboard\Plugin\Calendar\Formatter\TaskCalendarFormatter;
|
||||||
|
|
||||||
class Plugin extends Base
|
class Plugin extends Base
|
||||||
@@ -16,6 +17,10 @@ class Plugin extends Base
|
|||||||
return new TaskCalendarFormatter($c);
|
return new TaskCalendarFormatter($c);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$this->container['projectApiFormatter'] = $this->container->factory(function ($c) {
|
||||||
|
return new ProjectApiFormatter($c);
|
||||||
|
});
|
||||||
|
|
||||||
$this->template->hook->attach('template:dashboard:page-header:menu', 'Calendar:dashboard/menu');
|
$this->template->hook->attach('template:dashboard:page-header:menu', 'Calendar:dashboard/menu');
|
||||||
$this->template->hook->attach('template:project:dropdown', 'Calendar:project/dropdown');
|
$this->template->hook->attach('template:project:dropdown', 'Calendar:project/dropdown');
|
||||||
$this->template->hook->attach('template:project-header:view-switcher', 'Calendar:project_header/views');
|
$this->template->hook->attach('template:project-header:view-switcher', 'Calendar:project_header/views');
|
||||||
|
|||||||
Reference in New Issue
Block a user