public function init()
    {
        $grav = Grav::instance();

        /** @var Config $config */
        $config = $grav['config'];

        /** @var EventDispatcher $events */
        $events = $grav['events'];

        foreach ($this->items as $instance) {
            // Register only enabled plugins.
            if ($config["plugins.{$instance->name}.enabled"] && $instance instanceof Plugin) {
                $instance->setConfig($config);
                $events->addSubscriber($instance);
            }
        }

        return $this->items;
    }
public function init()
    {
        $grav = Grav::instance();

        /** @var Config $config */
        $config = $grav['config'];

        /** @var EventDispatcher $events */
        $events = $grav['events'];

        foreach ($this->items as $instance) {
            // Register only enabled plugins.
            if ($config["plugins.{$instance->name}.enabled"] && $instance instanceof Plugin) {
                $instance->setConfig($config);
                $events->addSubscriber($instance);
            }
        }

        return $this->items;
    }
public function init ( ) { $ grav = Grav :: instance ( ) ; /** @var Config $config */ $ config = $ grav [ 'config' ] ; /** @var EventDispatcher $events */ $ events = $ grav [ 'events' ] ; foreach ( $ this -> items as $ instance ) { // Register only enabled plugins. if ( $ config [ "plugins.{$instance->name}.enabled" ] && $ instance instanceof Plugin ) { $ instance -> setConfig ( $ config ) ; $ events -> addSubscriber ( $ instance ) ; } } return $ this -> items ; }
Registers all plugins.

@return Plugin[] array of Plugin objects
@throws \RuntimeException
Registers all plugins .