Class Index

Classes


Namespace wptheme.contextMenu.extension.badge

Namespace Summary
Constructor Attributes Constructor Name and Description
 
This extension provides support for displaying badges for each menuitem of the contextmenu.
Method Summary
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'
Alternatively to the badeUrl the menuitem can also contain the badgeData element. The badgeData element must be a JSON object with the same elements as the feed that is returned from badgeUrl. Additionally, the badgeTitle can be set to define a tooltip for the badge which displays more information.
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

Copyright (c) 2014 IBM Corporation
Documentation generated by JsDoc Toolkit 2.4.0 on Fri Jan 12 2024 10:11:14 GMT-0000 (UTC)