Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Previously known as Top menu and Totara menu.

Plugin developers can also add Totara menu options as follows:

...

  • public function get_default_visibility() - Returns a menu visibility constant to set the visibility when first added. Default is menu::SHOW_WHEN_REQUIRED.
  • public function get_default_sortorder() - Returns an integer to indicate default location within the menu when first added. Default is add to the end.
  • protected function check_visibility() - Returns either menu::SHOW_ALWAYS or menu::HIDE_ALWAYS. Called if visibility is set to menu::SHOW_WHEN_REQUIRED. Defaults to menu::SHOW_ALWAYS.
  • protected function get_default_parent() - Returns the class name of another menu item to use as the parent. Defaults to 'root' meaning top level.

 Add a new file [your-module]/db/totaramenu.php with the following:

...

Bump the version of your module to trigger a database upgrade. The new menu item will be detected and automatically added to the menu.

The main menu structure is cached in user session for a certain period. If an admin setting affects availability of menu item then developer should add 'totara_menu_reset_all_caches' as setting update callback.

...