本文整理汇总了PHP中App\Controller\AppController::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP AppController::initialize方法的具体用法?PHP AppController::initialize怎么用?PHP AppController::initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Controller\AppController
的用法示例。
在下文中一共展示了AppController::initialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
public function initialize()
{
parent::initialize();
$this->loadComponent('RequestHandler');
$this->loadComponent('Paginator');
$this->loadComponent('Excel');
}
示例2: initialize
/**
* Initialize callback
*
* @return void
*/
public function initialize()
{
parent::initialize();
if ($this->request->action === 'index') {
$this->loadComponent('Recaptcha.Recaptcha');
}
}
示例3: initialize
/**
* Initialize callback
*
* @return void
*/
public function initialize()
{
parent::initialize();
if (in_array($this->request->action, ['index', 'multipleWidgets'])) {
$this->loadComponent('Recaptcha.Recaptcha');
}
}
示例4: initialize
/**
* Initialize
*
* @return void
*/
public function initialize()
{
parent::initialize();
$this->loadComponent('Security');
$this->loadComponent('Csrf');
$this->loadComponent('CakeDC/Users.UsersAuth');
}
示例5: initialize
public function initialize()
{
parent::initialize();
/**
* Define Content settings
*/
Configure::write('Content', ['defaultUsersTable' => 'Users', 'defaultRolesTable' => 'Roles', 'defaultSiteId' => 1]);
/**
* Manage site selector
*/
if ($this->request->is(['patch', 'post', 'put'])) {
if (isset($this->request->data['current_site_id'])) {
$this->request->session()->write('Content.currentSiteId', intval($this->request->data['current_site_id']));
}
}
$this->CmsSites = TableRegistry::get('Content.CmsSites');
$sites = $this->CmsSites->find('all')->toArray();
$site_selector = [];
foreach ($sites as $row) {
$site_selector[$row->id] = $row->name;
if (!$this->request->session()->check('Content.currentSiteId')) {
$this->request->session()->write('Content.currentSiteId', $row->id);
}
}
$this->set(compact('site_selector'));
}
示例6: initialize
public function initialize()
{
parent::initialize();
$this->loadModel('Messages');
$this->loadModel('Offers');
$this->loadModel('Applies');
}
示例7: initialize
/**
* Initialization hook method.
*
* @return void
*/
public function initialize()
{
parent::initialize();
// Deny public access
$this->Auth->deny('index');
$this->Auth->config('unauthorizedRedirect', ['controller' => 'forums', 'action' => 'index']);
}
示例8: initialize
public function initialize()
{
parent::initialize();
$this->viewBuilder()->layout('frontend');
$this->response->disableCache();
$this->set('webroot_full', Router::url('/', true));
}
示例9: initialize
public function initialize()
{
parent::initialize();
// $this->connectCrudViews([
// 'Activities.duplicateActivityRow'
// ]);
}
示例10: initialize
/**
* Initialization hook method.
*
* Use this method to add common initialization code like loading components.
*
* @return void
*/
public function initialize()
{
$this->helpers[] = 'CkTools.CkTools';
$this->helpers[] = 'ListFilter.ListFilter';
$this->components[] = 'ListFilter.ListFilter';
parent::initialize();
}
示例11: initialize
/**
*Initialize
*/
public function initialize()
{
parent::initialize();
// TODO: Change the autogenerated stub
$this->loadModel('Advertisements');
$this->loadModel('News');
$this->loadModel('Banners');
$this->loadModel('NewsCategories');
$this->loadModel('Inquiries');
$this->loadModel('Activities');
$this->loadModel('Contacts');
$this->loadModel('Settings');
$this->loadModel('Members');
$this->loadModel('HomeMenus');
$this->loadModel('TypeCompanies');
$this->loadModel('TypeBusiness');
$this->loadModel('Productions');
$this->loadModel('CompanyInquiries');
$this->loadModel('RegisterInquiries');
$this->loadModel('EmailStacks');
$this->loadModel('Members');
$this->loadModel('Events');
$this->loadModel('Supporters');
$this->loadModel('CategorySupporters');
$this->loadModel('SupporterCities');
}
示例12: initialize
public function initialize()
{
parent::initialize();
$this->loadComponent('Flash');
// Include the FlashComponent
$this->Auth->allow(['index']);
}
示例13: initialize
public function initialize()
{
parent::initialize();
// Set the layout
$this->viewBuilder()->layout('admin');
$this->loadComponent('Cewi/Excel.Import');
}
示例14: initialize
/**
* @return void
*/
public function initialize()
{
parent::initialize();
$this->viewClass = 'CrudView\\View\\CrudView';
$tables = ['Clients', 'Scopes'];
$this->loadComponent('Crud.Crud', ['actions' => ['index' => ['className' => 'Crud.Index', 'scaffold' => ['tables' => $tables]], 'view' => ['className' => 'Crud.View', 'scaffold' => ['tables' => $tables]], 'edit' => ['className' => 'Crud.Edit', 'scaffold' => ['tables' => $tables, 'fields' => ['id' => ['label' => 'ID', 'type' => 'text'], 'description']]], 'add' => ['className' => 'Crud.Add', 'scaffold' => ['tables' => $tables, 'fields' => ['id' => ['label' => 'ID', 'type' => 'text'], 'description']]], 'delete' => ['className' => 'Crud.Delete', 'scaffold' => ['tables' => $tables]]], 'listeners' => ['CrudView.View', 'Crud.RelatedModels', 'Crud.Redirect']]);
}
示例15: initialize
public function initialize()
{
parent::initialize();
// Set the layout
$this->viewBuilder()->layout('admin');
//$this->Auth->allow();
}