Before Display Page
do_action_ref_array( 'vikrestaurants_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 tables page will trigger an hook called vikrestaurants_before_display_tables
.
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 table management view.
/**
* Fires before the controller displays the page.
*
* @param JView &$page The page instance.
*/
add_action('vikrestaurants_before_display_managetable', function(&$page)
{
$page->setLayout('edit');
});
This way, the plugin will search for this file while displaying the page:
/wp-content/plugins/vikrestaurants/admin/views/managetable/tmpl/edit.php
rather than the default one:
/wp-content/plugins/vikrestaurants/admin/views/managetable/tmpl/default.php
Changelog
Version | Description |
---|---|
1.0 | Introduced. |
Ultimo aggiornamento: 2021-10-04
Utile?