コード例 #1
0
 /**
  * Check plugin admin menu file configuration.
  *
  * @return void
  */
 public function testOnSetup()
 {
     $request = new Request(['params' => ['prefix' => 'admin', 'plugin' => 'TestPlugin', 'controller' => 'Display', 'action' => 'index']]);
     $controller = new AppController($request);
     $eventHandler = new UnionEventHandler();
     $event = new Event('App.Controller.Setup', $controller);
     $controller->beforeFilter($event);
     $eventHandler->onSetup($event);
     $this->assertSame('create menu :-)', Configure::read('TestPlugin.admin_menu'));
 }
コード例 #2
0
ファイル: AppComponent.php プロジェクト: UnionCMS/Core
 /**
  * Setup redirect by request data action.
  *
  * @param array $options
  * @return \Cake\Network\Response|null
  */
 public function redirect(array $options = [])
 {
     $plugin = $this->request->param('plugin');
     $controller = $this->request->param('controller');
     $_options = ['apply' => [], 'savenew' => ['plugin' => $plugin, 'controller' => $controller, 'action' => 'add'], 'save' => ['plugin' => $plugin, 'controller' => $controller, 'action' => 'index']];
     $options = Hash::merge($_options, $options);
     $url = $options['save'];
     if ($rAction = $this->request->data('action')) {
         list(, $action) = pluginSplit($rAction);
         if (isset($options[$action])) {
             $url = $options[$action];
         }
     }
     return $this->_controller->redirect($url);
 }
コード例 #3
0
ファイル: AppController.php プロジェクト: UnionCMS/Skeleton
 /**
  * Initialization hook method.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
 }
コード例 #4
0
ファイル: AppController.php プロジェクト: UnionCMS/Community
 public function beforeFilter(Event $event)
 {
     parent::beforeFilter($event);
 }