You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
2.4 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <?php namespace Wpstudio\AssetsManifest;
  2. use Backend;
  3. use System\Classes\PluginBase;
  4. use Wpstudio\AssetsManifest\Classes\TwigFilters;
  5. use Wpstudio\Assetsmanifest\Components\Manifest;
  6. /**
  7. * assetsmanifest Plugin Information File
  8. */
  9. class Plugin extends PluginBase
  10. {
  11. /**
  12. * Returns information about this plugin.
  13. *
  14. * @return array
  15. */
  16. public function pluginDetails()
  17. {
  18. return [
  19. 'name' => 'Assets manifest',
  20. 'description' => 'Assets with manifest.json',
  21. 'author' => 'wpstudio',
  22. 'icon' => 'icon-leaf'
  23. ];
  24. }
  25. /**
  26. * Register method, called when the plugin is first registered.
  27. *
  28. * @return void
  29. */
  30. public function register()
  31. {
  32. }
  33. /**
  34. * Boot method, called right before the request route.
  35. *
  36. * @return array
  37. */
  38. public function boot()
  39. {
  40. }
  41. /**
  42. * Registers any front-end components implemented in this plugin.
  43. *
  44. * @return array
  45. */
  46. public function registerComponents()
  47. {
  48. return [
  49. Manifest::class => 'manifest',
  50. ];
  51. }
  52. /**
  53. * Registers any back-end permissions used by this plugin.
  54. *
  55. * @return array
  56. */
  57. public function registerPermissions()
  58. {
  59. return []; // Remove this line to activate
  60. return [
  61. 'wpstudio.assetsmanifest.some_permission' => [
  62. 'tab' => 'assetsmanifest',
  63. 'label' => 'Some permission'
  64. ],
  65. ];
  66. }
  67. /**
  68. * Registers back-end navigation items for this plugin.
  69. *
  70. * @return array
  71. */
  72. public function registerNavigation()
  73. {
  74. return []; // Remove this line to activate
  75. return [
  76. 'assetsmanifest' => [
  77. 'label' => 'assetsmanifest',
  78. 'url' => Backend::url('wpstudio/assetsmanifest/mycontroller'),
  79. 'icon' => 'icon-leaf',
  80. 'permissions' => ['wpstudio.assetsmanifest.*'],
  81. 'order' => 500,
  82. ],
  83. ];
  84. }
  85. public function registerMarkupTags()
  86. {
  87. return [
  88. 'filters' => [
  89. 'manifest' => [TwigFilters::class, 'manifest'],
  90. ],
  91. 'functions' => [
  92. 'manifest' => [TwigFilters::class, 'manifest'],
  93. ],
  94. ];
  95. }
  96. }