3
1

Plugin.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php namespace Kanboard\Plugin\OMIProjectBranding;
  2. use Kanboard\Core\Plugin\Base;
  3. use Kanboard\Core\Translator;
  4. use Kanboard\Plugin\OMIProjectBranding\Listener\ColorListExtender;
  5. /**
  6. * Plugin Initialisation
  7. *
  8. * @package Kanboard\Plugin\OMIProjectBranding
  9. * @author Dwayne @ OMI NZ
  10. */
  11. class Plugin extends Base {
  12. public function initialize() {
  13. $this->container["helper"]->register("projectBrandingHelper", "\Kanboard\Plugin\OMIProjectBranding\Helper\ProjectBrandingHelper");
  14. $this->hook->on("template:project:sidebar", ["template" => "OMIProjectBranding:project/sidebar"]);
  15. $this->route->addRoute("project/:project_id/branding", "ProjectBrandingController", "show", "OMIProjectBranding");
  16. $this->template->setTemplateOverride("header", "OMIProjectBranding:header");
  17. $this->container['colorModel'] = $this->container->factory(function ($c) {
  18. return new \Kanboard\Plugin\OMIProjectBranding\Model\CustomColorModel($c);
  19. });
  20. }
  21. public function onColorList(Event $event)
  22. {
  23. $colors = $event->get('colors');
  24. $colors['brand_color_1'] = [
  25. 'name' => 'Client Primary',
  26. 'background' => '#1A2B3C',
  27. 'border' => '#0F1A2B',
  28. ];
  29. $colors['brand_color_2'] = [
  30. 'name' => 'Client Secondary',
  31. 'background' => '#D9E3F1',
  32. 'border' => '#C4D1E5',
  33. ];
  34. $event->set('colors', $colors);
  35. }
  36. public function getClasses()
  37. {
  38. return [
  39. 'Plugin\OMIProjectBranding\Controller' => [
  40. 'ProjectBrandingController',
  41. ],
  42. 'Plugin\OMIProjectBranding\Model' => [
  43. 'ProjectBrandingModel',
  44. 'CustomColorModel',
  45. ],
  46. 'Plugin\OMIProjectBranding\Helper' => [
  47. 'ProjectBrandingHelper',
  48. ],
  49. ];
  50. }
  51. public function getPluginName() {
  52. return "OMI Project Branding";
  53. }
  54. public function getPluginDescription() {
  55. return t("Project Branding plugin for Kanboard, to allow a custom logo and some brand colours per project.");
  56. }
  57. public function getPluginAuthor() {
  58. return "OMI NZ";
  59. }
  60. public function getPluginVersion() {
  61. return "1.0.3";
  62. }
  63. public function getPluginHomepage() {
  64. return "https://vcs.nz/ominz/OMIProjectBranding";
  65. }
  66. }
  67. #-
  68. #plugins/OMIProjectBranding/Plugin.php