English (United Kingdom)
Knowledge Base  >  Vik Restaurants  >  Hooks  >  API  >  Init Framework

apply_filters_ref_array( 'vikrestaurants_init_application_framework', bool $status, FrameworkAPIs &$api )

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.3 release and will be no longer supported starting from the 1.5 version of VikRestaurants. You should rather use the vikrestaurants_start_api action.

Parameters

$status

(bool)  True on success, false otherwise.

&$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:

/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  FrameworkAPIs  &$api    The framework API instance.
 */
add_filter('vikrestaurants_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.3 This filter has been officially deprecated and will be no longer supported starting from the 1.5 version.
1.1 Introduced.
Last Update: 2023-12-19
Helpful?