Mecha CMS

Deep learning on using the API.

Class Extend

Author: Taufik Nurrohman · 73 Views

Tweet

Working with extensions.

Table of Content

Exist 

Return the folder path of current extension folder if exists.

Extend::exist($input, $fail = false);

Example:

if ($path = Extend::exist('minify')) {
    // do something with `$path`…
}

State 

Return the stored extension states if any, otherwise, return $fail.

Extend::state($id, $key = null, $fail = false);

Example:

$state = Extend::state('minify');

Note: If $key is array, then it will going to be the alternate values of the $state output if some data are not available:

$state = Extend::state('minify', [
    'html' => [2, 1] // add `html` property to `$state` if missing
]);

Hooks 

KeyDescription
extend.state.{$id}Will affect the state output of extension with name $id.

Note: . characters in $id will be converted into \.

0 Comments

No comments yet.