/**
  * Constructor hook method.
  *
  * @param array $config
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     if ($this->isAdmin()) {
         $this->_backendMenu();
     }
 }
Example #2
0
 /**
  * Test request prefix methods.
  *
  * @return void
  */
 public function testRequestPrefix()
 {
     $this->assertFalse($this->App->getPrefix());
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $this->Controller->request->params['prefix'] = 'site';
     $this->assertSame('site', $this->App->getPrefix());
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $this->Controller->request->params['prefix'] = '';
     $this->assertTrue($this->App->isSite());
     $this->Controller->request->params['prefix'] = false;
     $this->assertTrue($this->App->isSite());
     $this->Controller->request->params['prefix'] = null;
     $this->assertTrue($this->App->isSite());
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $this->Controller->request->params['prefix'] = 'admin';
     $this->assertSame('admin', $this->App->getPrefix());
     $this->assertTrue($this->App->isAdmin());
 }
Example #3
0
 /**
  * Constructor hook method.
  *
  * @param array $config
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $_config = ['redirect' => ['prefix' => $this->request->param('prefix'), 'plugin' => $this->request->param('plugin'), 'controller' => $this->request->param('controller'), 'action' => 'index'], 'messages' => ['no_action' => __d('union', 'Action not found.'), 'no_chose' => __d('union', 'Please choose only one item for this operation.')]];
     $this->config(Hash::merge($_config, $config));
 }