Plugin
in package
implements
EventSubscriberInterface, ArrayAccess
Class Plugin
Table of Contents
Interfaces
- EventSubscriberInterface
- ArrayAccess
Properties
- $features : array<string|int, mixed>
- $name : string
- $active : bool
- $blueprint : Blueprint|null
- $config : Config|null
- $grav : Grav
- $loader : ClassLoader|null
Methods
- __construct() : mixed
- Constructor.
- __debugInfo() : array<string|int, mixed>
- config() : array<string|int, mixed>
- Get configuration of the plugin.
- getBlueprint() : Blueprint
- Simpler getter for the plugin blueprint
- getSubscribedEvents() : array<string|int, mixed>
- By default assign all methods as listeners using the default priority.
- inheritedConfigOption() : mixed
- isAdmin() : bool
- Determine if plugin is running under the admin
- isCli() : bool
- Determine if plugin is running under the CLI
- offsetExists() : bool
- Whether or not an offset exists.
- offsetGet() : mixed
- Returns the value at specified offset.
- offsetSet() : mixed
- Assigns a value to the specified offset.
- offsetUnset() : mixed
- Unsets an offset.
- saveConfig() : bool
- Persists to disk the plugin parameters currently stored in the Grav Config object
- setConfig() : $this
- disable() : void
- enable() : void
- isPluginActiveAdmin() : bool
- Determine if this route is in Admin and active for the plugin
- loadBlueprint() : void
- Load blueprints.
- mergeConfig() : Data
- Merge global and page configurations.
- parseLinks() : string
- This function will search a string for markdown links in a specific format. The link value can be optionally compared against via the $internal_regex and operated on by the callback $function provided.
- getPriority() : int
- mergeArrays() : array<string|int, mixed>
- Merge arrays based on deepness
Properties
$features
public
array<string|int, mixed>
$features
= []
$name
public
string
$name
$active
protected
bool
$active
= true
$blueprint
protected
Blueprint|null
$blueprint
$config
protected
Config|null
$config
$grav
protected
Grav
$grav
$loader
protected
ClassLoader|null
$loader
Methods
__construct()
Constructor.
public
__construct(string $name, Grav $grav[, Config|null $config = null ]) : mixed
Parameters
__debugInfo()
public
__debugInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>config()
Get configuration of the plugin.
public
config() : array<string|int, mixed>
Return values
array<string|int, mixed>getBlueprint()
Simpler getter for the plugin blueprint
public
getBlueprint() : Blueprint
Return values
BlueprintgetSubscribedEvents()
By default assign all methods as listeners using the default priority.
public
static getSubscribedEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>inheritedConfigOption()
public
static inheritedConfigOption(string $plugin, string $var[, PageInterface $page = null ][, mixed $default = null ]) : mixed
Parameters
- $plugin : string
- $var : string
- $page : PageInterface = null
- $default : mixed = null
isAdmin()
Determine if plugin is running under the admin
public
isAdmin() : bool
Return values
boolisCli()
Determine if plugin is running under the CLI
public
isCli() : bool
Return values
booloffsetExists()
Whether or not an offset exists.
public
offsetExists(string $offset) : bool
Parameters
- $offset : string
-
An offset to check for.
Attributes
- #[ReturnTypeWillChange]
Return values
bool —Returns TRUE on success or FALSE on failure.
offsetGet()
Returns the value at specified offset.
public
offsetGet(string $offset) : mixed
Parameters
- $offset : string
-
The offset to retrieve.
Attributes
- #[ReturnTypeWillChange]
Return values
mixed —Can return all value types.
offsetSet()
Assigns a value to the specified offset.
public
offsetSet(string $offset, mixed $value) : mixed
Parameters
- $offset : string
-
The offset to assign the value to.
- $value : mixed
-
The value to set.
Tags
Attributes
- #[ReturnTypeWillChange]
offsetUnset()
Unsets an offset.
public
offsetUnset(string $offset) : mixed
Parameters
- $offset : string
-
The offset to unset.
Tags
Attributes
- #[ReturnTypeWillChange]
saveConfig()
Persists to disk the plugin parameters currently stored in the Grav Config object
public
static saveConfig(string $name) : bool
Parameters
- $name : string
-
The name of the plugin whose config it should store.
Return values
boolsetConfig()
public
setConfig(Config $config) : $this
Parameters
- $config : Config
Return values
$thisdisable()
protected
disable(array<string|int, mixed> $events) : void
Parameters
- $events : array<string|int, mixed>
enable()
protected
enable(array<string|int, mixed> $events) : void
Parameters
- $events : array<string|int, mixed>
isPluginActiveAdmin()
Determine if this route is in Admin and active for the plugin
protected
isPluginActiveAdmin(string $plugin_route) : bool
Parameters
- $plugin_route : string
Return values
boolloadBlueprint()
Load blueprints.
protected
loadBlueprint() : void
mergeConfig()
Merge global and page configurations.
protected
mergeConfig(PageInterface $page[, mixed $deep = false ][, array<string|int, mixed> $params = [] ][, string $type = 'plugins' ]) : Data
WARNING: This method modifies page header!
Parameters
- $page : PageInterface
-
The page to merge the configurations with the plugin settings.
- $deep : mixed = false
-
false = shallow|true = recursive|merge = recursive+unique
- $params : array<string|int, mixed> = []
-
Array of additional configuration options to merge with the plugin settings.
- $type : string = 'plugins'
-
Is this 'plugins' or 'themes'
Return values
DataparseLinks()
This function will search a string for markdown links in a specific format. The link value can be optionally compared against via the $internal_regex and operated on by the callback $function provided.
protected
parseLinks(string $content, callable $function[, string $internal_regex = '(.*)' ]) : string
format: plugin:myplugin_name
Parameters
- $content : string
-
The string to perform operations upon
- $function : callable
-
The anonymous callback function
- $internal_regex : string = '(.*)'
-
Optional internal regex to extra data from
Return values
stringgetPriority()
private
getPriority(array<string|int, mixed> $params, string $eventName) : int
Parameters
- $params : array<string|int, mixed>
- $eventName : string
Return values
intmergeArrays()
Merge arrays based on deepness
private
mergeArrays(string|bool $deep, array<string|int, mixed> $array1, array<string|int, mixed> $array2) : array<string|int, mixed>
Parameters
- $deep : string|bool
- $array1 : array<string|int, mixed>
- $array2 : array<string|int, mixed>