當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Component::trigger方法代碼示例

本文整理匯總了PHP中yii\base\Component::trigger方法的典型用法代碼示例。如果您正苦於以下問題:PHP Component::trigger方法的具體用法?PHP Component::trigger怎麽用?PHP Component::trigger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\base\Component的用法示例。


在下文中一共展示了Component::trigger方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: triggerComponentEvent

 public function triggerComponentEvent($name, Event $event, Component $component)
 {
     if ($component === null) {
         return;
     }
     $component->trigger($name, $event);
 }
開發者ID:entityfx,項目名稱:yii2-utils,代碼行數:7,代碼來源:ComponentBase.php

示例2: trigger

 /**
  * @param string $name
  * @param Event $event
  */
 public function trigger($name, Event $event = null)
 {
     parent::trigger($name, $event);
     foreach ($this->_container as $model) {
         /** @var EmbeddedDocument $model */
         $model->trigger($name, $event);
     }
 }
開發者ID:ske,項目名稱:yii2-mongodb-embedded,代碼行數:12,代碼來源:Storage.php

示例3: fire

 /**
  * 
  * @param string|Event $event
  * @param array $params
  */
 public function fire($event)
 {
     $params = func_get_args();
     array_shift($params);
     if (is_string($event)) {
         $name = $event;
         $event = new Event($name, $params);
     } else {
         $name = $event->name;
         if ($event instanceof Event) {
             $event->params = $params;
         }
     }
     if (!in_array($name, $this->_eventStates) && ($this->maxLevel === 0 || count($this->_eventStates) < $this->maxLevel)) {
         array_push($this->_eventStates, $name);
         parent::trigger($name, $event);
         array_pop($this->_eventStates);
     }
 }
開發者ID:sangkilsoft,項目名稱:sangkilbiz-3,代碼行數:24,代碼來源:Hooks.php

示例4: trigger

 /**
  * Triggers a plugin event.
  * This method override locates all plugins within [[group]] and automatically allows each plugin to register
  * itself as event handler in this manager.
  * 
  * If a plugin implements [[PluginInterface]] the [[PluginInterface::register()]] method is called allowing the
  * plugin to register itself as event handler in the plugin manager (or any other subclass of [[Component]]).
  *
  * Usage:
  *
  * ~~~php
  * Yii::$app->big->pluginManager->setFolder('@app/plugins')->setGroup('users')->trigger('user.saved');
  * ~~~
  *
  * @param string $name the event name.
  * @param Event $event the event parameter. If not set, a default [[Event]] object will be created.
  * @throws yii\base\InvalidConfigException if [[group]] or [[pluginsFolder]] is not set in this manager.
  */
 public function trigger($name, Event $event = null)
 {
     if (!$this->pluginsFolder) {
         throw new InvalidConfigException('The property "$pluginsFolder" must be set in ' . get_class($this) . '.');
     } elseif (!$this->group) {
         throw new InvalidConfigException('The property "$group" must be set in ' . get_class($this) . '.');
     }
     $this->activateGroup($this->group);
     parent::trigger($name, $event);
 }
開發者ID:bigbrush,項目名稱:yii2-big,代碼行數:28,代碼來源:PluginManager.php


注:本文中的yii\base\Component::trigger方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。