Skip to content

GlobalMenu

Daryl Hedley edited this page May 14, 2014 · 9 revisions

Description

The Global Menu module enables plugins or core to add items to the global menu drop down to the top left of the authoring tool.

API

Origin.globalMenu.addItem([itemObject]) - Adds an item to the global menu.

Origin.globalMenu.addSubItem([subItemObject]) - Adds a sub item to the global menu.

To add an item to the menu, pass in an itemObject like this:

var itemObject = {
    "location": "global",
    "text": "Editor",
    "icon": "editor",
    "callbackEvent": "editor:open"
};

Origin.globalMenu.addItem(itemObject);

location - Where in the authoring tool this menu item is visible. Full list below.

text - Text displayed in the menu.

icon - Icon to be displayed with the text.

callbackEvent - Event that is triggered on click. This event will be prefixed with 'globalMenu' - 'globalMenu:editor:open'

To add a sub item to a menu item, pass in an subItemObject like this:

var subItemObject = {
    "parent": "Editor",
    "location": "editor",
    "text": "Theme settings",
    "icon": "theme",
    "callbackEvent": "editor:theme:open"
};

Origin.globalMenu.addSubItem(subItemObject);

parent - The parent menu item that this sub item will expand from.

location - Where in the authoring tool this menu item is visible. Full list below.

text - Text displayed in the menu.

icon - Icon to be displayed with the text.

callbackEvent - Event that is triggered on click. This event will be prefixed with 'globalMenu' - 'globalMenu:editor:open'

List of full locations

global - Will show always.

dashboard - Will only show on the dashboard.

editor - Will show when editing.

editor:structure - Will only show when editing the structure of a course.

editor:page - Will show only when editing a page.

Clone this wiki locally