childlist.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace Grav\Plugin;
  3. use Composer\Autoload\ClassLoader;
  4. use Grav\Common\Plugin;
  5. use Grav\Common\Page\Page;
  6. /**
  7. * Class ChildlistPlugin
  8. * @package Grav\Plugin
  9. */
  10. class ChildlistPlugin extends Plugin
  11. {
  12. /**
  13. * @return array
  14. *
  15. * The getSubscribedEvents() gives the core a list of events
  16. * that the plugin wants to listen to. The key of each
  17. * array section is the event that the plugin listens to
  18. * and the value (in the form of an array) contains the
  19. * callable (or function) as well as the priority. The
  20. * higher the number the higher the priority.
  21. */
  22. public static function getSubscribedEvents()
  23. {
  24. return [
  25. 'onPluginsInitialized' => [
  26. ['autoload', 100000], // TODO: Remove when plugin requires Grav >=1.7
  27. ['onPluginsInitialized', 0]
  28. ]
  29. ];
  30. }
  31. /**
  32. * Composer autoload.
  33. *is
  34. * @return ClassLoader
  35. */
  36. public function autoload(): ClassLoader
  37. {
  38. return require __DIR__ . '/vendor/autoload.php';
  39. }
  40. /**
  41. * Initialize the plugin
  42. */
  43. public function onPluginsInitialized()
  44. {
  45. // Don't proceed if we are in the admin plugin
  46. // if ($this->isAdmin()) {
  47. // return;
  48. // }
  49. // Enable the main events we are interested in
  50. $this->enable([
  51. // Put your main events here
  52. ]);
  53. }
  54. public function onAdminTwigTemplatePaths($event){
  55. $paths = $event['paths'];
  56. $paths[] = __DIR__ . '/admin/themes/grav/templates';
  57. $event['paths'] = $paths;
  58. }
  59. }