<?php
namespace Grav\Plugin;

use Composer\Autoload\ClassLoader;
use Grav\Common\Plugin;
use Grav\Common\Page\Page;

/**
 * Class ChildlistPlugin
 * @package Grav\Plugin
 */
class ChildlistPlugin extends Plugin
{
    /**
     * @return array
     *
     * The getSubscribedEvents() gives the core a list of events
     *     that the plugin wants to listen to. The key of each
     *     array section is the event that the plugin listens to
     *     and the value (in the form of an array) contains the
     *     callable (or function) as well as the priority. The
     *     higher the number the higher the priority.
     */
    public static function getSubscribedEvents()
    {
        return [
            'onPluginsInitialized' => [
                ['autoload', 100000], // TODO: Remove when plugin requires Grav >=1.7
                ['onPluginsInitialized', 0]
            ]
        ];
    }

    /**
    * Composer autoload.
    *is
    * @return ClassLoader
    */
    public function autoload(): ClassLoader
    {
        return require __DIR__ . '/vendor/autoload.php';
    }

    /**
     * Initialize the plugin
     */
    public function onPluginsInitialized()
    {
        // Don't proceed if we are in the admin plugin
        // if ($this->isAdmin()) {
        //     return;
        // }

        // Enable the main events we are interested in
        $this->enable([
            // Put your main events here
        ]);
    }
    public function onAdminTwigTemplatePaths($event){
      $paths = $event['paths'];
      $paths[] = __DIR__ . '/admin/themes/grav/templates';
      $event['paths'] = $paths;
    }
}
