Italian (Italy)
Knowledge Base  >  Vik Appointments  >  Hook  >  Core  >  Before Display Page

do_action_ref_array( 'vikappointments_before_display_{$page}', JView &$view )

Fires before displaying a page of the plugin.


Description

This hook is triggered every time the plugin is going to display a page. It is possible to use this hook to prepare a page with custom contents and resources.

The dynamic portion of the hook name, $page, refers to the name of the page calling the hook. This means that, for example, the services page will trigger an hook called vikappointments_before_display_services.

DO NOT echo any HTML in this hook to avoid sending the headers in advance.


Parameters

&$page

(JView)  The page instance.


Example

The example below explains how to change the default layout used by the service management view.

/**
 * Fires before the controller displays the page.
 *
 * @param  JView  &$page  The page instance.
 */
add_action('vikappointments_before_display_manageservice', function(&$page)
{
    $page->setLayout('edit');
});

This way, the plugin will search for this file while displaying the page:

/wp-content/plugins/vikappointments/admin/views/manageservice/tmpl/edit.php

rather than the default one:

/wp-content/plugins/vikappointments/admin/views/manageservice/tmpl/default.php

Changelog

Version Description
1.0 Introduced.
Ultimo aggiornamento: 2022-05-16
Utile?