public function onInitApplicationFramework( FrameworkAPIs &$api ) : void

Fires while initializing the API framework.


Description

Trigger hook to let the plugins alter the application framework. It is possible to use this hook to include third-party applications.

In order to extend the list of supported plugins/applications, 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/applications also from the specified folders.

IMPORTANT WARNING: This filter has been officially deprecated since the 1.9 release and will be no longer supported starting from the 1.11 version of VikRestaurants. You should rather use the onStartVikRestaurantsAPI event.

Parameters

&$api

(FrameworkAPIs)  The framework API instance.


Example

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

/plugins/vikrestaurants/e4j/apps/

All the PHP files contained within the apps folder of the VikRestaurants - 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   FrameworkAPIs  &$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

Version Description
1.9 This filter has been officially deprecated and will be no longer supported starting from the 1.11 version.
1.8.2 Introduced.
Last Update: 2023-12-29 14:15
Helpful?