How to add item to Top Menu in the Manager

To aid usability for Editors I want to add two items to the Top Menu in the Manager

  • Site Settings (a link to the Manager page for the ClientConfig Extra)
  • Clear Cache (to trigger the core Clear Cache action)

The Site Settings link works by adding a new Menu item and duplicating the settings of the default Menu item added by ClientConfig as a child of the Extras Menu.

The Clear Cache link requires Lexicon entries for Key and Description. I added these to my MIGXdb Component which is named Venue in a new file /core/components/venue/lexicon/en/core_extensions.inc.php with content.

<?php
$_lang['core_extension.clear_cache'] = 'Clear Cache';
$_lang['core_extension.clear_cache_desc'] = 'Clear the site cache';

Selecting the new Clear Cache link works in that does clear the site cache, but on hover the lexicon Key entered in the Menu Description field is shown, not it’s value.

The Menu item is configured as

  • Lexicon Key: core_extension.clear_cache
  • Description: core_extension.clear_cache_desc
  • Handler: MODx.clearCache(); return false;
  • Permission: empty_cache
  • Action: home
  • Namespace: venue
  • Icon:

As a test I tried to use existing Lexicons by updating the Menu item to

  • Lexicon Key: clear_cache
  • Description: clear_cache
  • Namespace: core

This works and shows the value Clear Cache on hover, and is probably a better solution to use the core lexicons instead of custom.

But I’m still interested to learn why my attempt failed? I have other Lexicons in the Venue Namespace working elsewhere on site by loading the Venue package in the Snippets that use the Lexicons.

Can anyone point me in the right direction please?

Thanks,

Chris

The lexicon strings probably have to be in the “default” topic to make it work → /core/components/venue/lexicon/en/default.inc.php.

These may help:

This works, thank you.

Added to my reading list for later this evening, thanks.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.