observe_admin_menu/3

Used for fetching the menu in the admin.

Type:

foldl

Return:

list of admin menu items

#admin_menu{} properties: none

Example

By observing this notification, you can add your own menu items to the admin menu. The admin_menu notification is a fold which build up the menu, allowing each callback to add and remove menu items as they wish.

For example, this add a menu separator and an “edit homepage” button to the “content” submenu:

-include_lib("zotonic_core/include/zotonic.hrl").
-include_lib("zotonic_mod_admin/include/admin_menu.hrl").

observe_admin_menu(#admin_menu{}, Acc, _Context) ->
[
    #menu_separator{parent=admin_content},
    #menu_item{
        id=admin_edit_homepage,
        parent=admin_content,
        label="Edit homepage",
        url={admin_edit_rsc, [{id, page_home}]}
    } |Acc
].

The default submenu names are admin_content, admin_structure, admin_modules, admin_auth and admin_system, but you are free to add your own submenus.

Edit on GitHub

Referred by

Models

admin_menu

This model holds the admin menu, which is built up by calling each module to add items to the menu.

Observed by

Modules

mod_admin_identity

Provides identity management in the admin - for example the storage of usernames and passwords.

Modules

mod_admin

Admin backend module that wires the core admin interface, assets, and admin-specific event handling.

Modules

mod_menu

Create nested navigation menus for your site.

Modules

mod_admin_statistics

Admin module exposing site statistics views and related dashboard metrics.

Modules

mod_translation

This module provides support for dealing with multiple languages.

Modules

mod_backup

mod_backup serves two different purposes: it makes a nightly backup of your files and database, and can also backup/restore individual resource items.

Modules

mod_admin_keyword

Add keyword analysis tools to the Zotonic administration interface.

Modules

mod_auth2fa

Two-factor authentication module adding TOTP setup, verification flows, and related auth checks.

Modules

mod_content_groups

Module for content group support and ACL-aware content group behavior.

Modules

mod_custom_redirect

Enables redirects from unknown hosts and paths to other locations. The other location can be a known path or another web site.

Modules

mod_admin_predicate

Add support for editing predicates in the admin, by presenting a list of all defined predicates on http://yoursite.com/admin/predicate .

Modules

mod_filestore

Support for storing uploaded and generated images and documents on external services.

Modules

mod_seo

Adds basic search engine optimization to the base templates and provides an admin interface for configuring SEO options and Google Universal Analytics.

Modules

mod_mailinglist

This module implements a mailing list system. You can make as many mailing lists as you like and send any page to any mailing list, including confirm mail and…

Modules

mod_comment

Implements a basic commenting system, enabling commenting on resources.

Modules

mod_import_csv

Module which adds “import CSV” button to the admin status screen.

Modules

mod_authentication

This module contains the main Zotonic authentication mechanism. It contains the logon and logoff controllers, and implements the various hooks as described in…

Modules

mod_admin_modules

Adds support in the admin for activating and deactivating modules.

Modules

mod_logging

Logs messages to the database and adds log views to the admin.

Modules

mod_l10n

Localization of Zotonic. Provides lookups for country, month, week names. Localization module providing locale, country, and timezone data and related helpers.

Modules

mod_admin_config

Add support for editing the site’s configuration values, as accessed through model#config.

Modules

mod_oauth2

OAuth2 provider module for app/client/token management and authorization flows.