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
Namespace: Cake\Core
Location: Core/BasePlugin.php

Inherited Constants

Properties summary

Method Summary

Method Detail

__construct()source public

__construct( array $options = [] )

Constructor

Parameters

array $options optional []
Options

bootstrap()source public

bootstrap( Cake\Core\PluginApplicationInterface $app )

Load all the application configuration and bootstrap logic.

Parameters

Cake\Core\PluginApplicationInterface $app
The host application

Implementation of

Cake\Core\PluginInterface::bootstrap()

checkHook()source protected

checkHook( string $hook )

Check if a hook name is valid

Parameters

string $hook
The hook name to check

Throws

InvalidArgumentException
on invalid hooks

console()source public

console( Cake\Console\CommandCollection $commands )

Add console commands for the plugin.

Parameters

Cake\Console\CommandCollection $commands
The command collection to update

Returns

Cake\Console\CommandCollection

Implementation of

Cake\Core\PluginInterface::console()

disable()source public

disable( string $hook )

Disables the named hook

Parameters

string $hook
The hook to disable

Returns


$this

Implementation of

Cake\Core\PluginInterface::disable()

enable()source public

enable( string $hook )

Enables the named hook

Parameters

string $hook
The hook to disable

Returns


$this

Implementation of

Cake\Core\PluginInterface::enable()

getClassPath()source public

getClassPath( )

Get the filesystem path to configuration for this plugin

Returns

string

Implementation of

Cake\Core\PluginInterface::getClassPath()

getConfigPath()source public

getConfigPath( )

Get the filesystem path to configuration for this plugin

Returns

string

Implementation of

Cake\Core\PluginInterface::getConfigPath()

getName()source public

getName( )

Get the name of this plugin.

Returns

string

Implementation of

Cake\Core\PluginInterface::getName()

getPath()source public

getPath( )

Get the filesystem path to this plugin

Returns

string

Implementation of

Cake\Core\PluginInterface::getPath()

initialize()source public

initialize( )

isEnabled()source public

isEnabled( string $hook )

Check if the named hook is enabled

Parameters

string $hook
The hook to check

Returns

boolean

Implementation of

Cake\Core\PluginInterface::isEnabled()

middleware()source public

middleware( Cake\Http\MiddlewareQueue $middleware )

Add middleware for the plugin.

Parameters

Cake\Http\MiddlewareQueue $middleware
The middleware queue to update.

Returns

Cake\Http\MiddlewareQueue

Implementation of

Cake\Core\PluginInterface::middleware()

routes()source public

routes( Cake\Routing\RouteBuilder $routes )

Add routes for the plugin.

Parameters

Cake\Routing\RouteBuilder $routes
The route builder to update.

Implementation of

Cake\Core\PluginInterface::routes()

Properties detail

$bootstrapEnabledsource

protected boolean

Do bootstrapping or not

true

$classPathsource

protected string

The class path for this plugin.

$configPathsource

protected string

The config path for this plugin.

$consoleEnabledsource

protected boolean

Console middleware

true

$middlewareEnabledsource

protected boolean

Enable middleware

true

$namesource

protected string

The name of this plugin

$pathsource

protected string

The path to this plugin.

$routesEnabledsource

protected boolean

Load routes or not

true

© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.6/class-Cake.Core.BasePlugin.html