English (United Kingdom)
Knowledge Base  >  Vik Appointments  >  Hooks  >  API  >  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.
Last Update: 2021-10-05
Helpful?
See Also:

This website uses cookies

This website uses cookies and similar technologies. Some of these technologies are necessary for the proper functioning of the website (Essential). Other technologies are used to evaluate user behavior (Analysis), to integrate external media or for advertising purposes. If you agree, these technologies are activated. For details, please refer to the privacy policy. From this same page you can also update/revoke your consent. If you do not give your consent, only cookies with essential functions will be activated.

We use technologies from the USA on our website. If you give your consent, you therefore consent at the same time to your data being transferred to the USA. We would like to point out that the USA does not have a level of data protection comparable to that of the EU and that any US company can be obliged by state authorities to hand over your data without you having any effective legal protection against this.