\Cake\CoreBasePlugin

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.

Summary

Methods
Properties
Constants
__construct()
initialize()
getName()
getPath()
getConfigPath()
getClassPath()
enable()
disable()
isEnabled()
routes()
bootstrap()
console()
middleware()
No public properties found
No constants found
checkHook()
$bootstrapEnabled
$routesEnabled
$middlewareEnabled
$consoleEnabled
$path
$classPath
$configPath
$name
N/A
No private methods found
No private properties found
N/A

Properties

$bootstrapEnabled

$bootstrapEnabled : boolean

Do bootstrapping or not

Type

boolean

$routesEnabled

$routesEnabled : boolean

Load routes or not

Type

boolean

$middlewareEnabled

$middlewareEnabled : boolean

Enable middleware

Type

boolean

$consoleEnabled

$consoleEnabled : boolean

Console middleware

Type

boolean

$path

$path : string

The path to this plugin.

Type

string

$classPath

$classPath : string

The class path for this plugin.

Type

string

$configPath

$configPath : string

The config path for this plugin.

Type

string

$name

$name : string

The name of this plugin

Type

string

Methods

__construct()

__construct(array  $options = array()) 

Constructor

Parameters

array $options

Options

initialize()

initialize() 

{@inheritdoc}

getName()

getName() : string

Get the name of this plugin.

Returns

string

getPath()

getPath() : string

Get the filesystem path to this plugin

Returns

string

getConfigPath()

getConfigPath() : string

Get the filesystem path to configuration for this plugin

Returns

string

getClassPath()

getClassPath() : string

Get the filesystem path to configuration for this plugin

Returns

string

enable()

enable(string  $hook) : $this

Enables the named hook

Parameters

string $hook

The hook to disable

Returns

$this

disable()

disable(string  $hook) : $this

Disables the named hook

Parameters

string $hook

The hook to disable

Returns

$this

isEnabled()

isEnabled(string  $hook) : boolean

Check if the named hook is enabled

Parameters

string $hook

The hook to check

Returns

boolean

routes()

routes(\Cake\Routing\RouteBuilder  $routes) : void

Add routes for the plugin.

The default implementation of this method will include the config/routes.php in the plugin if it exists. You can override this method to replace that behavior.

Parameters

\Cake\Routing\RouteBuilder $routes

The route builder to update.

bootstrap()

bootstrap(\Cake\Core\PluginApplicationInterface  $app) : void

Load all the application configuration and bootstrap logic.

The default implementation of this method will include the config/bootstrap.php in the plugin if it exist. You can override this method to replace that behavior.

The host application is provided as an argument. This allows you to load additional plugin dependencies, or attach events.

Parameters

\Cake\Core\PluginApplicationInterface $app

The host application

checkHook()

checkHook(string  $hook) : void

Check if a hook name is valid

Parameters

string $hook

The hook name to check

Throws

\InvalidArgumentException

on invalid hooks