Extension
in package
implements
ExtensionInterface
Uses
TaskErrors
Base class for all extensions.
Table of Contents
Interfaces
- ExtensionInterface
- Extension interface
Properties
- $taskErrors : array<string|int, mixed>
- Task errors
- $consoleClasses : array<string|int, mixed>
- Extension console classes
- $primary : bool
- Primary extension
Methods
- __call() : mixed
- Call function
- __construct() : mixed
- Constructor
- addAdminApiRoute() : bool
- Register control panel api route
- addApiRoute() : bool
- Register api route
- addError() : void
- Add error
- addHomePageRoute() : bool
- Register home page route
- addJob() : bool
- Add job to jobs registry
- addMiddleware() : bool
- Add middleware
- addPageRoute() : bool
- Register page route
- addPermission() : bool
- Add permission item
- addRelationMap() : bool
- Add relation map for Polymorphic Relations relations
- addRelationsMap() : bool
- Add relations map
- addShowPageRoute() : bool
- Register show page route
- clearErrors() : void
- Clear Error
- createDbTable() : bool
- Creaete extension db table
- createOption() : bool
- Create extension option
- createStorageFolder() : bool
- Create extension storage folder
- dropDbTable() : bool
- Drop extension db table
- getConsoleCommands() : array<string|int, mixed>
- Return console commands classes
- getControllerClassName() : string
- Get extension controller full class name
- getError() : mixed
- Get error
- getErrors() : array<string|int, mixed>
- Get errors
- getName() : string
- Return extension name
- hasError() : bool
- Return true if have error
- hasExtension() : bool
- Return true if extension exist
- hasInstalledExtension() : bool
- Return true if extension is installed
- hasModule() : bool
- Return true if module exist
- install() : void
- All extensions should implement install method
- installDriver() : bool|Model
- Install driver
- isPrimary() : bool
- Return true if extension is primary
- loadJsonConfigFile() : array<string|int, mixed>
- Load extension json config file
- postInstall() : void
- Run post install actions
- regiesterEventProperties() : bool
- Save event properties descriptor
- registerConsoleCommand() : bool
- Register console command class
- registerContentProvider() : bool
- Register content provider
- registerContentType() : bool
- Register content type
- registerContentTypeAction() : bool
- Register content type action
- registerEvent() : bool
- Register extension event
- registerJob() : bool
- Add job to jobs registry
- registerService() : bool
- Register service provider
- run() : mixed|false
- Call methods
- runService() : void
- Run service
- setPrimary() : void
- Set extension as primary (override all existing routes)
- setRouteRedirectUrl() : bool
- Set route redirect url
- unInstall() : void
- UnInstall extension
- unInstallDriver() : bool
- Uninstall driver
- unRegisterContentProvider() : bool
- Remove content provider
- unRegisterService() : bool
- UnRegister service provider
Properties
$taskErrors
Task errors
protected
array<string|int, mixed>
$taskErrors
= []
$consoleClasses
Extension console classes
private
array<string|int, mixed>
$consoleClasses
= []
$primary
Primary extension
private
bool
$primary
Methods
__call()
Call function
public
__call(string $method, array<string|int, mixed> $args) : mixed
Parameters
- $method : string
- $args : array<string|int, mixed>
__construct()
Constructor
public
__construct() : mixed
addAdminApiRoute()
Register control panel api route
public
addAdminApiRoute(string $method, string $pattern, string $class, string $handlerMethod[, null|string|array<string|int, mixed> $auth = 'session' ]) : bool
Parameters
- $method : string
- $pattern : string
- $class : string
- $handlerMethod : string
- $auth : null|string|array<string|int, mixed> = 'session'
Return values
booladdApiRoute()
Register api route
public
addApiRoute(string $method, string $pattern, string $class, string $handlerMethod[, null|int|string|array<string|int, mixed> $auth = null ][, int|null $type = null ]) : bool
Parameters
- $method : string
- $pattern : string
- $class : string
- $handlerMethod : string
- $auth : null|int|string|array<string|int, mixed> = null
- $type : int|null = null
Return values
booladdError()
Add error
public
addError(string $errorMessage) : void
Parameters
- $errorMessage : string
addHomePageRoute()
Register home page route
public
addHomePageRoute(string $pattern[, string|null $class = null ][, string|null $handlerMethod = null ][, string|null $pageName = null ][, null|string|array<string|int, mixed> $auth = null ][, string|null $routeName = null ][, bool $withLanguage = false ]) : bool
Parameters
- $pattern : string
- $class : string|null = null
- $handlerMethod : string|null = null
- $pageName : string|null = null
- $auth : null|string|array<string|int, mixed> = null
- $routeName : string|null = null
- $withLanguage : bool = false
Return values
booladdJob()
Add job to jobs registry
public
addJob(string $class[, string|null $name = null ][, bool $disabled = false ]) : bool
Parameters
- $class : string
- $name : string|null = null
- $disabled : bool = false
Return values
booladdMiddleware()
Add middleware
public
addMiddleware(string $method, string $pattern, mixed $class[, string|null $moduleName = null ]) : bool
Parameters
- $method : string
- $pattern : string
- $class : mixed
- $moduleName : string|null = null
Return values
booladdPageRoute()
Register page route
public
addPageRoute(string $pattern[, string|null $class = null ][, string|null $handlerMethod = null ][, string|null $pageName = null ][, null|string|array<string|int, mixed> $auth = null ][, string|null $routeName = null ][, bool $withLanguage = false ][, int $type = 1 ]) : bool
Parameters
- $pattern : string
- $class : string|null = null
- $handlerMethod : string|null = null
- $pageName : string|null = null
- $auth : null|string|array<string|int, mixed> = null
- $routeName : string|null = null
- $withLanguage : bool = false
- $type : int = 1
Return values
booladdPermission()
Add permission item
public
addPermission(string $name[, string|null $title = null ][, string|null $description = null ][, bool|null $deny = false ]) : bool
Parameters
- $name : string
- $title : string|null = null
- $description : string|null = null
- $deny : bool|null = false
Return values
booladdRelationMap()
Add relation map for Polymorphic Relations relations
public
addRelationMap(string $type, string $modelClass) : bool
Parameters
- $type : string
- $modelClass : string
Return values
booladdRelationsMap()
Add relations map
public
addRelationsMap(array<string|int, mixed> $items) : bool
Parameters
- $items : array<string|int, mixed>
Return values
booladdShowPageRoute()
Register show page route
public
addShowPageRoute(string $pattern, string $pageName[, null|string|array<string|int, mixed> $auth = null ][, bool $withLanguage = true ][, string|null $routeName = null ]) : bool
Parameters
- $pattern : string
- $pageName : string
- $auth : null|string|array<string|int, mixed> = null
- $withLanguage : bool = true
- $routeName : string|null = null
Return values
boolclearErrors()
Clear Error
public
clearErrors() : void
createDbTable()
Creaete extension db table
public
createDbTable(string $schemaClass) : bool
Parameters
- $schemaClass : string
Return values
boolcreateOption()
Create extension option
public
createOption(string $key, mixed $value[, bool $autoLoad = true ]) : bool
Parameters
- $key : string
- $value : mixed
- $autoLoad : bool = true
Return values
boolcreateStorageFolder()
Create extension storage folder
public
createStorageFolder([string|null $dir = null ][, bool $public = false ]) : bool
Parameters
- $dir : string|null = null
- $public : bool = false
Return values
booldropDbTable()
Drop extension db table
public
dropDbTable(string $schemaClass) : bool
Parameters
- $schemaClass : string
Return values
boolgetConsoleCommands()
Return console commands classes
public
getConsoleCommands() : array<string|int, mixed>
Return values
array<string|int, mixed>getControllerClassName()
Get extension controller full class name
public
getControllerClassName(string $class) : string
Parameters
- $class : string
Return values
stringgetError()
Get error
public
getError([int $index = 0 ]) : mixed
Parameters
- $index : int = 0
getErrors()
Get errors
public
getErrors() : array<string|int, mixed>
Return values
array<string|int, mixed>getName()
Return extension name
public
getName() : string
Return values
stringhasError()
Return true if have error
public
hasError() : bool
Return values
boolhasExtension()
Return true if extension exist
public
hasExtension(string $name) : bool
Parameters
- $name : string
Return values
boolhasInstalledExtension()
Return true if extension is installed
public
hasInstalledExtension(string $name) : bool
Parameters
- $name : string
Return values
boolhasModule()
Return true if module exist
public
hasModule(string $name) : bool
Parameters
- $name : string
Return values
boolinstall()
All extensions should implement install method
public
abstract install() : void
installDriver()
Install driver
public
installDriver(string|object $name[, string|null $class = null ][, string|null $category = null ][, string|null $title = null ][, string|null $description = null ][, string|null $version = null ][, array<string|int, mixed> $config = [] ]) : bool|Model
Parameters
- $name : string|object
-
Driver name, full class name or driver object ref
- $class : string|null = null
- $category : string|null = null
- $title : string|null = null
- $description : string|null = null
- $version : string|null = null
- $config : array<string|int, mixed> = []
Return values
bool|ModelisPrimary()
Return true if extension is primary
public
isPrimary() : bool
Return values
boolloadJsonConfigFile()
Load extension json config file
public
static loadJsonConfigFile(string $fileName, string $extensionName) : array<string|int, mixed>
Parameters
- $fileName : string
- $extensionName : string
Return values
array<string|int, mixed>postInstall()
Run post install actions
public
postInstall() : void
regiesterEventProperties()
Save event properties descriptor
public
regiesterEventProperties(string $name, mixed $descriptor) : bool
Parameters
- $name : string
- $descriptor : mixed
Return values
boolregisterConsoleCommand()
Register console command class
public
registerConsoleCommand(string $class) : bool
Parameters
- $class : string
Return values
boolregisterContentProvider()
Register content provider
public
registerContentProvider(string|object $provider) : bool
Parameters
- $provider : string|object
Return values
boolregisterContentType()
Register content type
public
registerContentType(string $class) : bool
Parameters
- $class : string
Return values
boolregisterContentTypeAction()
Register content type action
public
registerContentTypeAction(string $contentType, string $class) : bool
Parameters
- $contentType : string
- $class : string
Return values
boolregisterEvent()
Register extension event
public
registerEvent(string $name[, string|null $title = null ][, mixed $descriptor = null ]) : bool
Parameters
- $name : string
-
Event name
- $title : string|null = null
-
Event title
- $descriptor : mixed = null
Return values
boolregisterJob()
Add job to jobs registry
public
registerJob(string $class) : bool
Parameters
- $class : string
Return values
boolregisterService()
Register service provider
public
registerService(string $serviceProvider) : bool
Parameters
- $serviceProvider : string
Return values
boolrun()
Call methods
public
static run(string $baseClass, string $extension, Closure $callback) : mixed|false
Parameters
- $baseClass : string
- $extension : string
- $callback : Closure
Return values
mixed|falserunService()
Run service
public
runService(string $serviceName, Closure $callback) : void
Parameters
- $serviceName : string
- $callback : Closure
setPrimary()
Set extension as primary (override all existing routes)
public
setPrimary() : void
setRouteRedirectUrl()
Set route redirect url
public
setRouteRedirectUrl(string $method, string $pattern, string $url) : bool
Parameters
- $method : string
- $pattern : string
- $url : string
Return values
boolunInstall()
UnInstall extension
public
unInstall() : void
unInstallDriver()
Uninstall driver
public
unInstallDriver(string $name) : bool
Parameters
- $name : string
-
Driver name
Return values
boolunRegisterContentProvider()
Remove content provider
public
unRegisterContentProvider(string|object $provider) : bool
Parameters
- $provider : string|object
Return values
boolunRegisterService()
UnRegister service provider
public
unRegisterService(string $serviceProvider) : bool
Parameters
- $serviceProvider : string