IAdminForthPlugin
Properties
activationOrder
activationOrder:
number
Before activating all plugins are sorted by this number and then activated in order. If you want to make sure that your plugin is activated after some other plugin, set this number to higher value. (default is 0)
adminforth
adminforth:
IAdminForth
className
className:
string
customFolderName
customFolderName:
string
customFolderPath
customFolderPath:
string
pluginDir
pluginDir:
string
pluginInstanceId
pluginInstanceId:
string
pluginOptions
pluginOptions:
any
resourceConfig
resourceConfig:
AdminForthResource
Methods
componentPath()
componentPath(
componentFile
):string
Parameters
Parameter | Type |
---|---|
componentFile | string |
Returns
string
instanceUniqueRepresentation()
instanceUniqueRepresentation(
pluginOptions
):string
If plugin should support multiple installations per one resource, this function that should return unique string for each instance of plugin.
For example if plugin is installed for one column and this column defined as
targetColumn
in plugin options, then this method should return ${pluginOptions.targetColumn}
.
If plugin should support only one installation per resource, option can return 'single'
Parameters
Parameter | Type | Description |
---|---|---|
pluginOptions | any | options of plugin |
Returns
string
modifyResourceConfig()
modifyResourceConfig(
adminforth
,resourceConfig
):void
AdminForth plugins concept is based on modification of full AdminForth configuration to add some custom functionality. For example plugin might simply add custom field to resource by reusing AdminForthResourceColumn.components object, then add some hook which will modify record before getting or saving it to database.
So this method is core of AdminForth plugins. It allows to modify full resource configuration.
Parameters
Parameter | Type | Description |
---|---|---|
adminforth | IAdminForth | Instance of IAdminForth |
resourceConfig | AdminForthResource | Resource configuration object which will be modified by plugin |
Returns
void
setupEndpoints()
setupEndpoints(
server
):void
Here you can register custom endpoints for your plugin.
Parameters
Parameter | Type | Description |
---|---|---|
server | IHttpServer |
Returns
void
validateConfigAfterDiscover()?
optional
validateConfigAfterDiscover(adminforth
,resourceConfig
):void
Optional method which will be called after AdminForth discovers all resources and their columns. Can be used to validate types of columns, check if some columns are missing, etc.
Parameters
Parameter | Type |
---|---|
adminforth | IAdminForth |
resourceConfig | AdminForthResource |
Returns
void