public function onInitApplicationFramework(VAPApiFramework $api) : void

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

$api

(VAPApiFramework)  The framework API instance.

Return Value

None.


Example

The example below adds support for all the plugins/actions contained in a specific folder of a third-party plugin. Such as:

/plugins/vikappointments/e4j/apps/

All the PHP files contained within the apps folder of the VikAppointments - E4J 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   VAPApiFramework  $api  The framework API instance.
 *
 * @return  void
 */
public function onInitApplicationFramework($api)
{
    // fetch plugins folder path
    $folder = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'apps';

    // include apps folder
    $api->addIncludePath($folder);
}

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-05 16:34
Helpful?
See Also: