4AI hooks
Below is a list of all 4AI hooks which allows you to modify or extend its behavior programmatically.
Summary
Actions
Group: Api
forai_on_request_completed
Api action
Run hook with the request and response data after a request is completed.
@param \stdClass $provider @param array $requestDef @param array $request
@return void
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/model/provider.php
@line 267
Group: Content
forai_content_prepared
Content action
Action to let plugins obtain the finalized content for the current request
@param string $context The context of the content being passed to the plugin. @param mixed $row An object with a "text" property @param mixed $params Additional parameters. See {@see PlgContentContent()}. @param integer $page Optional page number. Unused. Defaults to zero.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 253
Group: Events
forai_onAfterDispatch
Events action
Hook to run the registered onAfterDispatch handlers.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 292
forai_onAfterDispatchComplete
Events action
Hook to run the registered onAfterDispatchComplete handlers.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 325
forai_onAfterInitialise
Events action
Hook to run the registered onAfterInitialise handlers.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 106
forai_onAfterRender
Events action
Hook to run the registered onAfterRoute handlers.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 406
forai_onAfterRenderComplete
Events action
Hook to run the registered onAfterRoute handlers.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 462
forai_onAfterRespond
Events action
Hook to run the registered onAfterRespond handlers.
Warning: body may be gzipped at this time.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 507
forai_onAfterRoute
Events action
Hook to run the registered onAfterRoute handlers.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 181
forai_onBeforeCompileHead
Events action
Hook to run the registered onBeforeCompileHead handlers.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 384
forai_onBeforeRender
Events action
Hook to run the registered onBeforeRender handlers.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 352
Filters
Group: Admin
forai_admin_ui_constants
Admin filter
Filter custom CSS for admin.
@param array $uiConstants List of constants related to the specific platform visual display.
@return array
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/view/admin.php
@line 71
forai_categories_list
Admin filter
Filter the list of categories on the site, for user display in the admin.
@param array $categories List of objects each describing a category.
@return array
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/api/controller/categories.php
@line 175
forai_custom_admin_css
Admin filter
Filter custom CSS for admin.
@param string $defaultStyles The raw css to be inserted as style tag in the page.
@return string
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/view/admin.php
@line 90
forai_custom_admin_js
Admin filter
Filter custom JS for admin.
@param string $js The javascript to be inserted into the page with a script tag.
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/view/admin.php
@line 226
forai_extensions_list
Admin filter
Filter the list of extensions installed on the site, for user display in the admin.
@param array $components List of objects each describing an extension.
@return array
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/api/controller/extensions.php
@line 85
Group: Api
forai_api_endpoint
Api filter
Filter the endpoint to which AI API provider requests are made.
@param string $endpoint @param array $endpoint Array of model name, prompts and temperature
@return array
@since 2.1.1
in /plugins/system/forai/vendor/weeblr/forai/helper/requester.php
@line 92
forai_api_request_data
Api filter
Filter the data sent to the AI API provider just before a request is made.
@param array $requestData Array of model name, prompts and temperature
@return array
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/helper/requester.php
@line 114
Group: Assistant
forai_should_inject_assistant
Assistant filter
Filter whether 4AI should inject the assistant in the current page. The filtered value
is the result of already applying basic checks and validation that 4AI is supposed to do.
Setting this to true will display the assistant but only if Joomla ACL are satisfied.
User permissions are checked after this filter and cannot be overridenn through this filter.
@param bool $shouldInject
@since 2.0.1
in /plugins/system/forai/vendor/weeblr/forai/controller/assistant.php
@line 244
Group: Bundle
forai_admin_js_bundle_url
Bundle filter
Filter main JS bundle URL.
@param string $url The url of the js bundle to be linked from the page.
@return string
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/view/admin.php
@line 108
forai_custom_admin_js
Bundle filter
Filter list of css files to be inserted after main bundle.
Each record added to the lsit must be:
[
'url' => '', mandatory
'options' => [], | []
'attr' => [], | []
]
@param array $cssDefs An array of array[url, options, attr], each defining a link to a css file.
@return string
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/view/admin.php
@line 360
Group: Config
forai_config
Config filter
Filter configuration right after creating it.
@param array $config @param string $scope
@return void
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/model/config.php
@line 83
forai_config_loaded
Config filter
Filter configuration right after loading it from the database.
@param array $config @param string $scope
@return void
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/model/config.php
@line 158
Group: Content
forai_onContentPrepare
Content filter
Hook to run the registered onContentPrepare handlers.
@param bool $modified Whether the content was modified. @param string $context The context of the content being passed to the plugin. @param mixed & $row An object with a "text" property @param mixed & $params Additional parameters. See {@see PlgContentContent()}. @param integer $page Optional page number. Unused. Defaults to zero.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 219
Group: Events
forai_onPrivacyCollectAdminCapabilities
Events filter
Hook to run the registered onAfterInitialise handlers.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 128
Group: Features
forai_features_overrides
Features filter
Filter features overrides
@param array $featuresOverrides
@return array
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/view/admin.php
@line 128
Group: Frontend
forai_fe_is_likely_edit_page
Frontend filter
Filter whether the current page is likely an edit page.
Can be used to display the assistant icon on more pages than the default
Joomla native edit pages already known by 4AI.
@param bool $isLikelyEditPage
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/controller/assistant.php
@line 100
Group: Output
forai_onAfterRenderComplete_body
Output filter
Filter the body of the CMS response at onAfterRender.
@param string $body Body of the current request.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 475
forai_onAfterRender_body
Output filter
Filter the body of the CMS response at onAfterRender.
@param string $body Body of the current request.
@since 1.0.0
in /plugins/system/forai/forai.php
@line 419
Group: Request
forai_request_info
Request filter
Filter the list of dynamic variables used in content replacement.
@param array $expandedVariables Array of variable names/variable values to use in expansions.
@return array
@since 1.0.0
in /plugins/system/forai/vendor/weeblr/forai/data/requestinfo.php
@line 126