API Docs

This documentation is automatically generated from Flask-Menu’s source code.

Flask extension

class flask.ext.menu.Menu(app=None)

Extension object for invenio.ext.menu

static root()
Returns:Root entry of current application’s menu.

Decorators

flask.ext.menu.register_menu(app, path, text, order=0, endpoint_arguments_constructor=None, dynamic_list_constructor=None, active_when=None, visible_when=None)

Decorate endpoints that should be displayed in a menu.

Example:

@register_menu(app, '.', _('Home'))
def index():
    pass
Parameters:
  • app – Application or Blueprint which owns the function view.
  • path – Path to this item in menu hierarchy, for example ‘main.category.item’. Path can be an object with custom __str__ method: it will be converted on first request, therefore you can use current_app inside this __str__ method.
  • text – Text displayed as link.
  • order – Index of item among other items in the same menu.
  • endpoint_arguments_constructor – Function returning dict of arguments passed to url_for when creating the link.
  • active_when – Function returning True when the item should be displayed as active.
  • visible_when – Function returning True when this item should be displayed.
  • dynamic_list_constructor – Function returning a list of entries to be displayed by this item. Every object should have ‘text’ and ‘url’ properties/dict elements. This property will not be directly affect the menu system, but allows other systems to use it while rendering.

Proxies

flask.ext.menu.current_menu

Root of a menu item.

Table Of Contents

Related Topics

This Page