summaryrefslogtreecommitdiff
path: root/app/ServiceProvider/FormatterProvider.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-12-20 20:06:39 -0500
committerFrederic Guillot <fred@kanboard.net>2016-12-20 20:06:39 -0500
commitae708a712a5dd932c01e734f8450b899b1407a70 (patch)
tree348c01ad849fbeeee0fba74118b4536af4119333 /app/ServiceProvider/FormatterProvider.php
parenta957195952e2c93177628ab07936d783da1388c3 (diff)
Offer the possibility to override internal formatter objects from plugins
Diffstat (limited to 'app/ServiceProvider/FormatterProvider.php')
-rw-r--r--app/ServiceProvider/FormatterProvider.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/app/ServiceProvider/FormatterProvider.php b/app/ServiceProvider/FormatterProvider.php
new file mode 100644
index 00000000..dbba3f3c
--- /dev/null
+++ b/app/ServiceProvider/FormatterProvider.php
@@ -0,0 +1,48 @@
+<?php
+
+namespace Kanboard\ServiceProvider;
+
+use Kanboard\Core\Tool;
+use Pimple\Container;
+use Pimple\ServiceProviderInterface;
+
+/**
+ * Class FormatterProvider
+ *
+ * @package Kanboard\ServiceProvider
+ * @author Frederic Guillot
+ */
+class FormatterProvider implements ServiceProviderInterface
+{
+ protected $formatters = array(
+ 'Formatter' => array(
+ 'BoardColumnFormatter',
+ 'BoardFormatter',
+ 'BoardSwimlaneFormatter',
+ 'BoardTaskFormatter',
+ 'GroupAutoCompleteFormatter',
+ 'ProjectActivityEventFormatter',
+ 'ProjectGanttFormatter',
+ 'SubtaskTimeTrackingCalendarFormatter',
+ 'TaskAutoCompleteFormatter',
+ 'TaskCalendarFormatter',
+ 'TaskGanttFormatter',
+ 'TaskICalFormatter',
+ 'TaskSuggestMenuFormatter',
+ 'UserAutoCompleteFormatter',
+ 'UserMentionFormatter',
+ )
+ );
+
+ /**
+ * Registers services on the given container.
+ *
+ * @param Container $container
+ * @return Container
+ */
+ public function register(Container $container)
+ {
+ Tool::buildFactories($container, $this->formatters);
+ return $container;
+ }
+}