Creating Menu Items
Adding Menu Items ¶
Movable Type allows you to add menu items to the main navigation of the site. This is a great way for you to provide convenient links to your users and an intuitive way in which to access your plugin.
The following sample code will add a menu item labeled "Upload Video" to the Create menu.
sub init_registry {
my $plugin = shift;
$plugin->registry({
applications => {
cms => {
menus => {
'create:video' => {
label => 'Upload Video',
mode => 'video_upload',
order => 301,
args => { _type => "blog" },
permission => 'manage_assets,publish_post',
view => "blog",
},
},
},
},
});
}
Here is an overview of the various properties of a menu item:
- label - the name of the menu item as it will appear in the menu
- mode - the app mode that will be invoked when you click the link. Note: this will require you to define and register an app mode with the same name as the value of this property.
- dialog - as an alternative to
modeone can specifydialogwhich will spawn a dialog window that invokes the mode with the name assigned to thedialogproperty - order - the order or placement as it will appear in the list.
- permission - a comma delimited list of required permissions in order for this menu item to be active for the current user
- args - a list of key/value pairs of querystring parameters that will be appended to the link associated with this menu item
- view - valid values are "blog" or "system" and they determine whether the menu item should appear in the blog context menu set or the "System Overview" menu set.
List of Permissions ¶
The following permissions are defined by Movable Type by default and can be used in conjunction with the "permission" property defined above:
System Permissions
- administer
- create_blog
- manage_plugins
- view_log
Blog Level Permissions
- administer_blog
- edit_config
- set_publish_paths
- edit_categories
- edit_tags
- edit_notifications
- view_blog_log
- create_post
- publish_post
- send_notifications
- edit_all_posts
- manage_pages
- rebuild
- edit_templates
- upload
- save_image_defaults
- edit_assets
- comment
- manage_feedback

Byrne Reese
August 5, 2007 6:07 PM | Reply
I have discovered that in order for menu items to appear properly the plugin you register with Movable Type must extend the MT::Plugin class. For example:
Dan Wolfgang
September 3, 2007 11:14 AM | Reply
For System Permissions, "administrator" is not a valid option; try "administer" instead.
Chris Ernest Hall
November 14, 2007 2:15 PM | Reply
@Dan Wolfgang: thanks for pointing that out. Today I stumbled across the same bug, and just fixed it. Apologies for not fixing it before.
Bryant
February 29, 2008 11:59 AM | Reply
Is it possible to create a new top-level menu, or do all new menu items need to go under an existing top-level (like "create" in the example)?
Byrne Reese
February 29, 2008 12:07 PM | Reply
Absolutely!
Kevin Shay
July 24, 2008 7:25 AM | Reply
The list above is missing the 'condition' property. This is a subroutine or handler that should return true or false to determine whether or not the menu item will appear in a given context. (It doesn't appear to get passed anything, but you can use MT->instance to get at various contextual information.)