Italian (Italy)

apply_filters_ref_array( 'vikappointments_before_build_menu', bool $status, MenuShape &$menu )

Fires before building the back-end main menu of the plugin.


Description

Plugins can use this hook to manipulate the back-end menu of VikAppointments at runtime.

It is useful in case you need to introduce additional separators and/or menu items. Otherwise, it is also possible to remove certain default menu items, such as the payments section.


Parameters

$status

(bool)  True on success, false on failure.

&$menu

(MenuShape)  The current menu instance. Since the argument is passed by reference, any changes applied to the instance will immediately take effect.


Example

The example below adds the Mail Text menu item under the Global category, and removes the Countries menu item from Portal category.

/**
 * Trigger action to allow the plugins to manipulate the back-end menu of VikAppointments.
 *
 * @param  boolean    $status  True on success, false on failure.
 * @param  MenuShape  &$menu   The menu to build.
 */
add_filter('vikappointments_before_build_menu', function($status, &$menu)
{
    $input = JFactory::getApplication()->input;

    // get "Global" separator. It can be found at index [5]
    $global = $menu->get(5);

    // create "Mail Text" menu item
    $mailtext = MenuFactory::createItem(
        __('Mail Text', 'vikappointments'),
        'admin.php?page=vikappointments&view=mailtextcust', $input->get('view') == 'mailtextcust'
    );
    // set icon for mail text
    $mailtext->setCustom('envelope');
	
    // add item at the end of the list
    $global->addChild($mailtext);

    // get "Portal" separator. It can be found at index [3]
    $portal = $menu->get(3);

    // delete "Countries" menu item
    $portal->unsetChild(array(
        'title' => __('Countries', 'vikappointments'),
    ));

    return true;
}, 10, 2);

Changelog

Version Description
1.0 Introduced.
Ultimo aggiornamento: 2021-10-05
Utile?
Potrebbe interessarti:

Questo sito web utilizza i cookie

Questo sito web utilizza cookie e tecnologie simili. Alcune di queste tecnologie sono necessarie per il corretto funzionamento del sito web (essenziali). Altre tecnologie sono utilizzate per valutare il comportamento degli utenti (analisi), per integrare media esterni o per scopi pubblicitari. Se l'utente accetta, queste tecnologie vengono attivate. I dettagli sono riportati nella Privacy Policy. Da questa stessa pagina è inoltre possibile aggiornare/revocare il consenso. Se non si fornisce il consenso, verranno attivati solo i cookie con funzioni essenziali.

Sul nostro sito web utilizziamo tecnologie provenienti dagli Stati Uniti. Pertanto, se acconsentite, acconsentite anche al trasferimento dei vostri dati negli Stati Uniti. Desideriamo sottolineare che gli Stati Uniti non hanno un livello di protezione dei dati paragonabile a quello dell'Unione Europea e che qualsiasi azienda statunitense può essere obbligata dalle autorità statali a consegnare i vostri dati senza che voi abbiate alcuno strumento efficace di protezione legale contro questo.