PluginApplicationInterface
extends
EventDispatcherInterface
in
Interface for Applications that leverage plugins & events.
Events can be bound to the application event manager during the application's bootstrap and plugin bootstrap.
Table of Contents
Methods
- addPlugin() : $this
- Add a plugin to the loaded plugin set.
- dispatchEvent() : EventInterface
- Wrapper for creating and dispatching events.
- getEventManager() : EventManagerInterface
- Returns the Cake\Event\EventManager manager instance for this object.
- pluginBootstrap() : void
- Run bootstrap logic for loaded plugins.
- pluginConsole() : CommandCollection
- Run console hooks for plugins
- pluginMiddleware() : MiddlewareQueue
- Run middleware hooks for plugins
- pluginRoutes() : RouteBuilder
- Run routes hooks for loaded plugins
- setEventManager() : $this
- Sets the Cake\Event\EventManager manager instance for this object.
Methods
addPlugin()
Add a plugin to the loaded plugin set.
public
addPlugin(PluginInterface|string $name[, array<string, mixed> $config = [] ]) : $this
If the named plugin does not exist, or does not define a Plugin class, an
instance of Cake\Core\BasePlugin
will be used. This generated class will have
all plugin hooks enabled.
Parameters
- $name : PluginInterface|string
-
The plugin name or plugin object.
- $config : array<string, mixed> = []
-
The configuration data for the plugin if using a string for $name
Return values
$thisdispatchEvent()
Wrapper for creating and dispatching events.
public
dispatchEvent(string $name[, array<string|int, mixed>|null $data = null ][, object|null $subject = null ]) : EventInterface
Returns a dispatched event.
Parameters
- $name : string
-
Name of the event.
- $data : array<string|int, mixed>|null = null
-
Any value you wish to be transported with this event to it can be read by listeners.
- $subject : object|null = null
-
The object that this event applies to ($this by default).
Return values
EventInterfacegetEventManager()
Returns the Cake\Event\EventManager manager instance for this object.
public
getEventManager() : EventManagerInterface
Return values
EventManagerInterfacepluginBootstrap()
Run bootstrap logic for loaded plugins.
public
pluginBootstrap() : void
pluginConsole()
Run console hooks for plugins
public
pluginConsole(CommandCollection $commands) : CommandCollection
Parameters
- $commands : CommandCollection
-
The CommandCollection to use.
Return values
CommandCollectionpluginMiddleware()
Run middleware hooks for plugins
public
pluginMiddleware(MiddlewareQueue $middleware) : MiddlewareQueue
Parameters
- $middleware : MiddlewareQueue
-
The MiddlewareQueue to use.
Return values
MiddlewareQueuepluginRoutes()
Run routes hooks for loaded plugins
public
pluginRoutes(RouteBuilder $routes) : RouteBuilder
Parameters
- $routes : RouteBuilder
-
The route builder to use.
Return values
RouteBuildersetEventManager()
Sets the Cake\Event\EventManager manager instance for this object.
public
setEventManager(EventManagerInterface $eventManager) : $this
You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.
Parameters
- $eventManager : EventManagerInterface
-
the eventManager to set