Class BasePlugin
Base Plugin Class
Every plugin should extends from this class or implement the interfaces and include a plugin class in it's src root folder.
- Cake\Core\BasePlugin implements Cake\Core\PluginInterface
Inherited Constants
Properties summary
-
$bootstrapEnabled
protectedboolean
Do bootstrapping or not -
$classPath
protectedstring
The class path for this plugin. -
$configPath
protectedstring
The config path for this plugin. -
$consoleEnabled
protectedboolean
Console middleware -
$middlewareEnabled
protectedboolean
Enable middleware -
$name
protectedstring
The name of this plugin -
$path
protectedstring
The path to this plugin. -
$routesEnabled
protectedboolean
Load routes or not
Method Summary
-
__construct() public
Constructor -
bootstrap() public
Load all the application configuration and bootstrap logic. -
checkHook() protected
Check if a hook name is valid -
console() public
Add console commands for the plugin. -
disable() public
Disables the named hook -
enable() public
Enables the named hook -
getClassPath() public
Get the filesystem path to configuration for this plugin -
getConfigPath() public
Get the filesystem path to configuration for this plugin -
getName() public
Get the name of this plugin. -
getPath() public
Get the filesystem path to this plugin -
initialize() public
-
isEnabled() public
Check if the named hook is enabled -
middleware() public
Add middleware for the plugin. -
routes() public
Add routes for the plugin.
Method Detail
__construct() public ¶
__construct( array $options [] )
Constructor
Parameters
- array $options optional []
- Options
bootstrap() public ¶
bootstrap( Cake\Core\PluginApplicationInterface
$app )
Load all the application configuration and bootstrap logic.
Parameters
-
Cake\Core\PluginApplicationInterface
$app - The host application
Implementation of
checkHook() protected ¶
checkHook( string $hook )
Check if a hook name is valid
Parameters
- string $hook
- The hook name to check
Throws
on invalid hooks
console() public ¶
console( Cake\Console\CommandCollection
$commands )
Add console commands for the plugin.
Parameters
-
Cake\Console\CommandCollection
$commands - The command collection to update
Returns
Implementation of
disable() public ¶
disable( string $hook )
Disables the named hook
Parameters
- string $hook
- The hook to disable
Returns
$this
Implementation of
enable() public ¶
enable( string $hook )
Enables the named hook
Parameters
- string $hook
- The hook to disable
Returns
$this
Implementation of
getClassPath() public ¶
getClassPath( )
Get the filesystem path to configuration for this plugin
Returns
Implementation of
getConfigPath() public ¶
getConfigPath( )
Get the filesystem path to configuration for this plugin
Returns
Implementation of
getPath() public ¶
getPath( )
Get the filesystem path to this plugin
Returns
Implementation of
isEnabled() public ¶
isEnabled( string $hook )
Check if the named hook is enabled
Parameters
- string $hook
- The hook to check
Returns
Implementation of
middleware() public ¶
middleware( Cake\Http\MiddlewareQueue
$middleware )
Add middleware for the plugin.
Parameters
-
Cake\Http\MiddlewareQueue
$middleware - The middleware queue to update.
Returns
Implementation of
routes() public ¶
routes( Cake\Routing\RouteBuilder
$routes )
Add routes for the plugin.
Parameters
-
Cake\Routing\RouteBuilder
$routes - The route builder to update.