Init Framework
apply_filters_ref_array( 'vikappointments_init_application_framework', bool $status, VAPApiFramework $api )
Fires while initializing the API framework.
Description
The API framework is used to connect remote applications to VikAppointments and to dispatch specific actions.
Trigger hook to let the plugins alter the application framework. It is possible to use this hook to support third-party actions.
In order to extend the list of supported plugins/actions, it is possible to use the code below.
$api->addIncludePath($path);
$api->addIncludePaths([$path1, $path2, ...]);
This will tell the API framework to load the plugins/actions also from the specified folders.
Parameters
- $status
-
(bool) True on success, false otherwise.
- $api
-
(VAPApiFramework) The framework API instance.
Example
The example below adds support for all the plugins/actions contained in a specific folder of a third-party plugin. Such as:
/wp-content/plugins/vikwp/apps/
All the PHP
files contained within the apps folder of the VikWP plugin will be loaded.
/**
* Trigger event to let the plugins alter the application framework.
* It is possible to use this event to include third-party applications.
*
* @param boolean $status True on success, false otherwise.
* @param VAPApiFramework $api The framework API instance.
*/
add_filter('vikappointments_init_application_framework', function($status, $api)
{
// fetch plugins folder path
$folder = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'apps';
// include apps folder
$api->addIncludePath($folder);
return $status;
}, 10, 2);
Changelog
Version | Description |
---|---|
1.2 | Introduced. |