/** * BeforeFilter Event * * This method will check if the `initPostTypes`-method exists in the * `AppController`. That method contains PostTypes to add. * * @param \Cake\Event\Event $event Event. * @return void */ public function beforeFilter($event) { $this->setController($event->subject()); if ($this->Controller->Manager->prefix('admin')) { if (method_exists($this->Controller, 'initPostTypes')) { $this->Controller->initPostTypes($event); } } }