theme, plugins und config für die Webseite der Baptisten Hohenacker https://baptisten-hohenacker.de
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.

53 lines
1.3 KiB

<?php
namespace Grav\Plugin;
use Grav\Common\Plugin;
use RocketTheme\Toolbox\Event\Event;
/**
* Class PythonScriptPlugin
* @package Grav\Plugin
*/
class PythonScriptPlugin 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' => ['onPluginsInitialized', 0]
];
}
/**
* Enable search only if url matches to the configuration.
*/
public function onPluginsInitialized()
{
if ($this->isAdmin()) {
$this->active = false;
return;
}
$this->enable([
'onTwigExtensions' => ['onTwigExtensions', 0]
]);
}
/**
* Add Twig Extensions
*/
public function onTwigExtensions()
{
require_once(__DIR__.'/twig/PythonScriptTwigExtension.php');
$this->grav['twig']->twig->addExtension(new PythonScriptTwigExtension());
}
}