当前位置: 首页>>代码示例>>PHP>>正文


PHP Controller::loadComponent方法代码示例

本文整理汇总了PHP中Cake\Controller\Controller::loadComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::loadComponent方法的具体用法?PHP Controller::loadComponent怎么用?PHP Controller::loadComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cake\Controller\Controller的用法示例。


在下文中一共展示了Controller::loadComponent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initialize

 /**
  * initialize
  *
  * @param array $config Config.
  * @return void
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $this->setController($this->_registry->getController());
     // adding request handler
     $this->Controller->loadComponent('RequestHandler');
     // accepts json
     $this->Controller->RequestHandler->renderAs($this->Controller, 'json');
     // set the default modelName
     if (is_null($this->config('modelName'))) {
         $this->config('modelName', $this->Controller->name);
     }
     if (Configure::read('Api.JWT')) {
         if ($this->Controller->Auth) {
             $this->Controller->Auth->config('authenticate', ['ADmad/JwtAuth.Jwt' => ['parameter' => '_token', 'userModel' => 'Users.Users', 'scope' => ['Users.active' => 1], 'fields' => ['id' => 'id']]]);
         }
     }
 }
开发者ID:jxav,项目名称:cakephp-api,代码行数:24,代码来源:ApiBuilderComponent.php

示例2: _initControllerAndRatings

 /**
  * Convenience method for testing: Initializes the controller and the Ratings component
  *
  * @param array $params Controller params
  * @return void
  */
 protected function _initControllerAndRatings($params = [])
 {
     $_default = ['?' => [], 'pass' => []];
     $this->Controller->request->params = array_merge($_default, $params);
     if (!empty($this->Controller->request->params['?'])) {
         $this->Controller->request->query = $this->Controller->request->params['?'];
     }
     $this->Controller->components()->unload('Ratings');
     $options = isset($this->Controller->components['Ratings.Ratings']) ? $this->Controller->components['Ratings.Ratings'] : [];
     $this->Controller->loadComponent('Ratings.Ratings', $options);
     $event = new Event('beforeFilter', $this->Controller);
     $this->Controller->Ratings->beforeFilter($event);
     //$this->Controller->Components->trigger('initialize', array(&$this->Controller));
     //$this->Controller->Auth = $this->AuthComponent;
     //$this->Controller->Ratings->beforeFilter($this->Controller);
 }
开发者ID:sonuchauhan,项目名称:cakephp-ratings,代码行数:22,代码来源:RatingsComponentTest.php

示例3: _createCrudComponentInstance

 /**
  * Creates instance of the Crud Component if it doesn't exist yet.
  *
  * @return void
  */
 protected function _createCrudComponentInstance()
 {
     if (!$this->_registry->has('Crud.Crud')) {
         $this->_controller->loadComponent('Crud.Crud', $this->config());
     }
 }
开发者ID:cakeplugins,项目名称:api,代码行数:11,代码来源:ApiBuilderComponent.php

示例4: _setupAuthComponent

 /**
  * Setup Auth component settings
  */
 protected function _setupAuthComponent()
 {
     $this->controller->loadComponent('Auth', Configure::read('Auth'));
 }
开发者ID:mohammadsaleh,项目名称:spider,代码行数:7,代码来源:AclManagerEventHandler.php

示例5: _loadComponent

 /**
  * Load controller component by configure.
  *
  * @param Controller $controller
  * @return void
  */
 protected static function _loadComponent(Controller $controller)
 {
     $hooks = self::_getConfigData(Hook::HOOK_CONFIG_COMPONENT_KEY);
     foreach ($hooks as $name => $params) {
         list($controllers, $config) = self::_createParams($params);
         if (self::_inController($controllers, $controller->name)) {
             $controller->loadComponent($name, $config);
         }
     }
 }
开发者ID:UnionCMS,项目名称:Core,代码行数:16,代码来源:Hook.php

示例6: __construct

 /**
  * Construct method.
  *
  * @param \Cake\Controller\Controller $controller The controller instance where the Event is dispatched.
  *
  * @return void
  */
 public function __construct($controller)
 {
     $this->Flash = $controller->loadComponent('Flash');
 }
开发者ID:Adnan0703,项目名称:Xeta,代码行数:11,代码来源:Badges.php


注:本文中的Cake\Controller\Controller::loadComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。