Grav\Plugin\AdminPlugin::onPluginsInitialized PHP Method

onPluginsInitialized() public method

If the admin plugin is set as active, initialize the admin
    public function onPluginsInitialized()
    {
        // Only activate admin if we're inside the admin path.
        if ($this->active) {
            // Store this version and prefer newer method
            if (method_exists($this, 'getBlueprint')) {
                $this->version = $this->getBlueprint()->version;
            } else {
                $this->version = $this->grav['plugins']->get('admin')->blueprints()->version;
            }
            // Test for correct Grav 1.1 version
            if (version_compare(GRAV_VERSION, '1.1.0-beta.1', '<')) {
                $messages = $this->grav['messages'];
                $messages->add($this->grav['language']->translate(['PLUGIN_ADMIN.NEEDS_GRAV_1_1', GRAV_VERSION]), 'error');
            }
            // Have a unique Admin-only Cache key
            if (method_exists($this->grav['cache'], 'setKey')) {
                $cache = $this->grav['cache'];
                $cache_key = $cache->getKey();
                $cache->setKey($cache_key . '$');
            }
            // Turn on Twig autoescaping
            if (method_exists($this->grav['twig'], 'setAutoescape') && $this->grav['uri']->param('task') != 'processmarkdown') {
                $this->grav['twig']->setAutoescape(true);
            }
            if (php_sapi_name() == 'cli-server') {
                throw new \RuntimeException('The Admin Plugin cannot run on the PHP built-in webserver. It needs Apache, Nginx or another full-featured web server.', 500);
            }
            $this->grav['debugger']->addMessage("Admin Basic");
            $this->initializeAdmin();
            // Disable Asset pipelining (old method - remove this after Grav is updated)
            if (!method_exists($this->grav['assets'], 'setJsPipeline')) {
                $this->config->set('system.assets.css_pipeline', false);
                $this->config->set('system.assets.js_pipeline', false);
            }
            // Replace themes service with admin.
            $this->grav['themes'] = function () {
                return new Themes($this->grav);
            };
        }
        // We need popularity no matter what
        $this->popularity = new Popularity();
        // Fire even to register permissions from other plugins
        $this->grav->fireEvent('onAdminRegisterPermissions', new Event(['admin' => $this->admin]));
    }