# observe\_admin\_menu/3

Source: https://zotonic.com/docs/1466/observe_admin_menu-3

URI: https://zotonic.com/id/1466

Language: en



Used for fetching the menu in the admin.

Type:

[foldl](/id/doc_developerguide_notifications#notification-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:

```erlang
-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.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1466?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1466?language=en>)
