Hi,
I try to make a new plugin, but i can’t collect his template.
The code is really minimalist and there is no other files than files created by devtools (SSH) and the folder “templates/single-product.html.twig”.
However, the template doesn’t appears when i try to create a page with this template.
I rode a lot of similar topics and docs but i do not have more idea.
Thank you!
<?php
namespace Grav\Plugin;
use \Grav\Common\Plugin;
use RocketTheme\Toolbox\Event\Event;
/**
* Class ModelePlugin
* @package Grav\Plugin
*/
class ModelePlugin 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 [
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0]
];
}
public function onTwigTemplatePaths()
{
$this->grav['twig']->twig_paths[] = __DIR__ . '/templates';
}
}