Should be called explicitely in Controller::beforeRender()

@param Event $event beforeRender event
@return void
10223
public function beforeRender(Event $event): void
    {
        $this->setJson('isAjax', $this->_controller->request->is('ajax'));
        $this->setJson('isMobile', $this->_controller->request->is('mobile'));
        $this->setBoth('isDialog', $this->_controller->request->is('dialog'));
        $this->setBoth('isJson', $this->_controller->request->is('json'));
        $this->setJson('debug', Configure::read('debug'));

        $ssl = false;
        if (env('HTTPS') || $this->_controller->request->is('ssl') || $this->_controller->request->env('HTTP_X_FORWARDED_PROTO') == 'https') {
            $ssl = true;
        }

        $appData = array(
            'jsonData' => $this->_jsonData,
            'webroot' => 'http' . ($ssl ? 's' : '') . '://' . env('HTTP_HOST') . $this->_controller->request->webroot,
            'url' => $this->_controller->request->url,
            // 'controller' => $this->_controller->name,
            // 'action' => $this->_controller->request->action,
            // 'plugin' => $this->_controller->request->plugin,
            'request' => array(
                'query' => $this->_controller->request->query,
                'pass' => $this->_controller->request->params['pass'],
                'plugin' => $this->_controller->request->plugin,
                'controller' => Inflector::underscore($this->_controller->name),
                'action' => $this->_controller->request->action
            )
        );

        // merge in the additional frontend data
        $appData = Hash::merge($appData, $this->_additionalAppData);
        $this->_controller->set('frontendData', $appData);
        $this->_controller->set('closeDialog', $this->_closeDialog);
    }
867431
public function beforeDeleteTree(Event $event)
    {
        if ($children = $this->getChildren()->all()) {
            foreach ($children as $childNode) {
                $childNode->delete();
            }
        }
    }
918334
public function beforeRender(Event $event) {
		if (in_array('Captcha.Captcha', $this->controller->helpers) || isset($this->controller->helpers['Captcha.Captcha'])) {
			return;
		}

		$this->controller->helpers[] = 'Captcha.Captcha';
	}
430788
public function beforeRender(Event $event)
    {
        parent::beforeRender($event);

        $this->set('title', $this->Settings['alias']);
    }
972468
public function onBeforeSend(Event $event)
    {
        /** @var \Guzzle\Http\Message\Request $request */
        $request = $event['request'];

        list($newUrl, $port) = $this->proxify(
            $request->getUrl(),
            $this->bucketKey,
            $this->gatewayHost
        );

        $request->setUrl($newUrl);

        if ($port) {
            $request->setHeader('Runscope-Request-Port', $port);
        }

        if ($this->authToken) {
            $request->setHeader('Runscope-Bucket-Auth', $this->authToken);
        }
    }
465514
public function beforeFilter(\Cake\Event\Event $event)
    {
        if (isset($this->Csrf) && in_array($event->subject()->request->params['action'], ['upload'])) {
            $this->eventManager()->off($this->Csrf);
        }

        parent::beforeFilter($event);
    }
854908
public function beforeFilter(\Cake\Event\Event $event)
    {
        parent::beforeFilter($event);

        // get the type-string
        $type = $this->PostTypes->postTypeFinder($this->request);
        $this->_type = $type;

        // check if the string exists. Will throw an exception
        $this->PostTypes->check($type, ['exception' => true]);

        // intialize the settings
        $this->Settings = $this->PostTypes->get($type);

        // lets initialize the model too
        $this->Model = $this->loadModel($this->Settings['model']);
    }
1301906
public function afterJavascriptStep($event)
    {
        /** @var \Behat\Behat\Hook\Scope\BeforeStepScope $event */
        if (!$this->hasTag('javascript')) {
            return;
        }
        $text = $event->getStep()->getText();
        if (preg_match('/(follow|press|click|submit)/i', $text)) {
            $this->iWaitForAjaxToFinish($event);
        }
    }
887671
public function beforeRenderFile(Event $event, $viewFile)
    {
        $pluginEvent = Plugin::getData('Core', 'View.beforeRenderFile');
        if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('View.beforeRenderFile')) {
            call_user_func_array($pluginEvent->find(0), [$this->_View, $event, $viewFile]);
        }
    }
114756
protected function beforeSave($event)
    {
        if ($this->autoSave) {
            $this->saveFile($this->owner->{$this->uploadAttribute}, $this->name, $this->path);
        }
    }
1106064
public function beforeFilter(Event $event)
    {
        $this->TimebasedCurrencyPayment = TableRegistry::getTableLocator()->get('TimebasedCurrencyPayments');
        $this->TimebasedCurrencyOrderDetail = TableRegistry::getTableLocator()->get('TimebasedCurrencyOrderDetails');
        parent::beforeFilter($event);
    }
48749
public function onBeforeRedirect(Event $event)
    {
        /**
         * @var Container $container
         * @var Collector $collector
         * @var Profiler  $profiler
         */
        $container = $event['app']->getContainer();
        $collector = $container->get('debugger.collector');
        $profiler  = $container->get('profiler');

        $collector['redirect'] = [
            'url' => $event['url'],
            'moved' => $event['moved'],
        ];
    }
240035
public function beforeDelete($event)
    {
        $oldId = $this->owner->{$this->savedAttribute};
        if (($oldModel = FileModel::findOne($oldId)) !== null) {
            $event->isValid = $event->isValid && $oldModel->delete();
        }
    }
468378
public function beforeUpdate($event)
    {
        foreach ($this->update as $field) {
            $event->sender->$field = time();
        }
    }
336589
private function captureOutlineOnBeforeOutlineEvent(Event $event)
    {
        if (!$event instanceof BeforeOutlineTested) {
            return;
        }

        $this->outline = $event->getOutline();
        $this->headerPrinted = false;
    }
24108
public function beforeRender(Event $event)
    {
        parent::beforeRender($event);

        $this->response->getStatusCode($this->httpStatusCode);

        if (200 != $this->httpStatusCode) {
            $this->responseStatus = $this->responseFormat['statusNokText'];
        }

        $response = [
            $this->responseFormat['statusKey'] => $this->responseStatus
        ];

        if (!empty($this->apiResponse)) {
            $response[$this->responseFormat['resultKey']] = $this->apiResponse;
        }

        $this->set('response', $response);
        $this->set('responseFormat', $this->responseFormat);

        return null;
    }
1015023
public function beforeFilter(Event $event) {
		// Check security component loaded and disable it for this plugin:
		if (isset($this->Security)) {
			$this->Security->setConfig('validatePost', false);
			$this->Security->setConfig('unlockedActions', ['save']);
		}

		if (isset($this->Csrf) && $this->request->getAttribute('params')['action'] === 'save') {
			$this->getEventManager()->off($this->Csrf);
		}

		if (Configure::read('Feedback')) {
			return null;
		}

		// Throw error, config file required
		throw new NotFoundException('No Feedback config found.');
	}