Namespace wptheme.contextMenu.extension.badge
Constructor Attributes | Constructor Name and Description |
---|---|
This extension provides support for displaying badges for each menuitem of the contextmenu.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
wptheme.contextMenu.extension.badge.getAnchor(menuitem)
This function provides a hook point for the badge that can be looked up within the menuitem's DOM.
|
<static> |
wptheme.contextMenu.extension.badge.injectBadge(domNode, menuitem)
Injects the badge into the menuitem's DOM node.
|
Namespace Detail
wptheme.contextMenu.extension.badge
This extension provides support for displaying badges for each menuitem of the contextmenu. A badge is a
number that is displayed within a colored rounded rectangle.
Badges can easily be enabled by setting the metadata badgeUrl or badgeData on the menuitem's metadata.
The feed that is returned from the badgeUrl must be of type JSON and must have two JSON elements on the root object
- count
The number to be displayed - level
String, which can be either 'error', 'warn', or 'info'
badgeUrl example: { "type": "StaticMenuitem", "id": "myEditFct", ... "metadata": { ... "badgeUrl": "?uri=theme-validation:count", "badgeTitle": "Your total number of errors, warnings and information messages." } }
badgeData example: { "type": "StaticMenuitem", "id": "myEditFct", ... "metadata": { ... "badgeData": { "count": "10", "level": "error" }, "badgeTitle": "Your total number of errors, warnings and information messages." } }
Method Detail
<static>
{String}
wptheme.contextMenu.extension.badge.getAnchor(menuitem)
This function provides a hook point for the badge that can be looked up within the menuitem's DOM.
- Parameters:
- {Object} menuitem
- the menuitem object as created by the simple menu framework
- Returns:
- {String} a string containing at least the class name wpthemeMenuBadgeAnchor which is used to look up the element
<static>
wptheme.contextMenu.extension.badge.injectBadge(domNode, menuitem)
Injects the badge into the menuitem's DOM node. The method relies on the previously created anchor that
has been created using getAnchor.
- Parameters:
- {DOMNode} domNode
- the DOM node that represents the menu item
- {Object} menuitem Optional
- the menuitem object as created by the simple menu framework