public function onDisplayVikAppointmentsPluginView(array $args) : string

Fires while trying to display a custom page through a plugin.


Description

Trigger event to let the plugins be able to render their contents on a stand-alone page. This hook triggers every time &task=plugin_view is specified within the query string.

In case a plugin needs to show/save some data that are not related to the existing tables of VikAppointments, it is possible to relate with this event without having to assign the plugin to the system group.

The event will pass to the attached subscribers all the arguments set within the $args property of the query string. In case of a query string built as &args[action]=custom.action&args[dummy]=foo, the method will receive as argument an array built as follows:

{
    "action": "custom.action",
    "dummy": "foo"
}

In this way it will be possible to check whether the plugin should execute something or if it should go ahead silently, since the same event might be used by other plugins.

This hook is triggered in both the site and admin sections.


Parameters

$args

(array)  A registry of arguments set in request.

Return Value

String. The HTML to display, if needed.


Example

/**
 * Trigger event to let the plugins be able to
 * render their contents on a stand-alone page.
 *
 * @param   Registry  $args  A registry of arguments set in request.
 *
 * @return  string    The HTML to display.
 */
public function onDisplayVikAppointmentsPluginView($args)
{
    if ($args->get('action') == 'myplugin.page')
    {
        $html = '';

        /**
         * @todo render HTML
         */

        return $html;
    }
}

Changelog

VersionDescription
1.6.6 Introduced.
Last Update: 2021-10-11 10:26
Helpful?