接口 PluginApplicationInterface
利用插件和事件的应用程序接口。
可以在应用程序引导和插件引导期间将事件绑定到应用程序事件管理器。
        
    命名空间: Cake\Core
    
    
    
      
  
  
        方法概要
- 
          addPlugin() public将插件添加到已加载的插件集中。 
- 
          dispatchEvent() public创建和分发事件的包装器。 
- 
          getEventManager() public返回此对象的 Cake\Event\EventManager 管理器实例。 
- 
          pluginBootstrap() public运行已加载插件的引导逻辑。 
- 
          pluginConsole() public运行插件的控制台钩子 
- 
          pluginMiddleware() public运行插件的中间件钩子 
- 
          pluginRoutes() public运行已加载插件的路由钩子 
- 
          setEventManager() public设置此对象的 Cake\Event\EventManager 管理器实例。 
方法详情
addPlugin() ¶ public
addPlugin(Cake\Core\PluginInterface|string $name, array<string, mixed> $config = []): $this将插件添加到已加载的插件集中。
如果指定的插件不存在,或没有定义 Plugin 类,将使用 Cake\Core\BasePlugin 的实例。此生成的类将启用所有插件钩子。
参数
- 
                Cake\Core\PluginInterface|string$name
- 插件名称或插件对象。 
- 
                array<string, mixed>$config optional
- 如果使用字符串作为 $name,则为插件的配置数据 
返回值
$thisdispatchEvent() ¶ public
dispatchEvent(string $name, array $data = [], TSubject|null $subject = null): Cake\Event\EventInterface<TSubject>创建和分发事件的包装器。
返回已分发的事件。
参数
- 
                string$name
- 事件名称。 
- 
                array$data optional
- 您希望通过此事件传输的任何值都可以被监听器读取。 
- 
                TSubject|null$subject optional
- 此事件适用的对象(默认为 $this)。 
返回值
Cake\Event\EventInterface<TSubject>getEventManager() ¶ public
getEventManager(): Cake\Event\EventManagerInterface返回此对象的 Cake\Event\EventManager 管理器实例。
返回值
Cake\Event\EventManagerInterfacepluginConsole() ¶ public
pluginConsole(Cake\Console\CommandCollection $commands): Cake\Console\CommandCollection运行插件的控制台钩子
参数
- 
                Cake\Console\CommandCollection$commands
- 要使用的 CommandCollection。 
返回值
Cake\Console\CommandCollectionpluginMiddleware() ¶ public
pluginMiddleware(Cake\Http\MiddlewareQueue $middleware): Cake\Http\MiddlewareQueue运行插件的中间件钩子
参数
- 
                Cake\Http\MiddlewareQueue$middleware
- 要使用的 MiddlewareQueue。 
返回值
Cake\Http\MiddlewareQueuepluginRoutes() ¶ public
pluginRoutes(Cake\Routing\RouteBuilder $routes): Cake\Routing\RouteBuilder运行已加载插件的路由钩子
参数
- 
                Cake\Routing\RouteBuilder$routes
- 要使用的路由构建器。 
返回值
Cake\Routing\RouteBuildersetEventManager() ¶ public
setEventManager(Cake\Event\EventManagerInterface $eventManager): $this设置此对象的 Cake\Event\EventManager 管理器实例。
您可以使用此实例向对象事件注册任何新的监听器或回调,或者创建您自己的事件并随意触发它们。
参数
- 
                Cake\Event\EventManagerInterface$eventManager
- 要设置的事件管理器 
返回值
$this