I created a new Theme based on Quark using devtools called mgc. Theme works fine.
In the simple generated file mgc.php I find the comment
// Access plugin events in this class
However, when I try the standard way, eg., as in a normal plugin, I get a theme error, viz.,
Template "@images/grav-logo.svg" is not defined in "partials/base.html.twig" at line 44.
This is clearly wrong since grav-logo.svg exists. And if I delete all of the extra functions, the Theme starts working again.
Some help about how to access Plugin events within a Theme file would help.
My work around so far is to create a new plugin to handle the functionality.
My mgc.php file is
<?php<?php
namespace Grav\Theme;
use Grav\Common\Theme;
use Grav\Common\Grav;
use Grav\Common\Plugin;
use Grav\Common\Twig\Twig;
use RocketTheme\Toolbox\Event\Event;
use RocketTheme\Toolbox\Session\Message;
class Mgc extends Quark
{
// Access plugin events in this class
public static function getSubscribedEvents()
{
return [
'onFormProcessed' => ['onFormProcessed',0]
];
}
public function onFormProcessed(Event $e) {
if ($this->isAdmin()) {
$this->active = false;
return;
}
}
}