Zurmo Module Configurations via Global Metadata

Global metadata properties can be found in Modules, Models, and Views. They are used to define configuration options related to a particular class.

Use the getDefaultMetadata() function to define the metadata properties.

The main purpose of the metadata Module is for menu generation, but the metadata can be used for other purposes, such as searches.

Below is the metadata configuration on the Accounts module and a description of the metadata properties.

public static function getDefaultMetadata()
    $metadata = array();
    $metadata['global'] = array(
       'designerMenuItems' => array(
           'showFieldsLink' => true,
           'showGeneralLink' => true,
           'showLayoutsLink' => true,
           'showMenusLink' => true,
       'globalSearchAttributeNames' => array(
       'tabMenuItems' => array(
                'label' => 'AccountsModulePluralLabel',
                'url'   => array('/accounts/default'),
                'right' => self::RIGHT_ACCESS_ACCOUNTS,
                'items' => array(
                       'label' => 'Create AccountsModuleSingularLabel',
                        'url'   => array('/accounts/default/create'),
                        'right' => self::RIGHT_CREATE_ACCOUNTS
                        'label' => 'AccountsModulePluralLabel',
                        'url'   => array('/accounts/default'),
                        'right' => self::RIGHT_ACCESS_ACCOUNTS
   return $metadata;

designerMenuItems defines options related to the designer module (ie. which menu/sections are available).
globalSearchAttributeNames defines global search fields that will be used in this module to filter results, when somebody searches the system using the header search form.
tabMenuItems is used to configure the main menu.

There are few more available options, such as:
configureMenuItems is used to configure links in the admin area (ie. to set up roles).
headerMenuItems is used to configure the top menu (Profile, About, Logout and other links).
tabMenuItemsModuleOrdering defines the order of links in main/tab menu.

Leave a Comment

  • http://profile.yahoo.com/WYPQ7CCRJGEPKAJIS62GTWT5FM Joshua

    I was curious what the proper way to change this data once it’s been serialized and stored in the database?

    I’ve been using zermo for a couple days now, playing around with it, and I’ve changed the name “Accounts” to something else. This created an entry in the globalmetadata table for accounts to store this name change. Now I want to make another change (I am currently trying to add a tab to the tabMenuItems). Since there is an entry in the globalmetadata table, it appears that it now ignores the data found in the getDefaultMetaData() function.

    I can get my tab to appear a couple of ways. 1) I can manually manipulate the serialized data in the globalmetadata table to include the new tabMenuItem, but that is difficult and prone to problems. 2) I can delete the entry in the globalmetadata table entirely and have it be re-written from the getDefaultMetadata function, but then I loose my name change.

    I am hoping for a solution is something like “updateMetadata()” that will deserialize the metadata, make only the change I am asking for, and re-serialize and save it. Now this function wouldn’t be very hard to write, but I want to make sure I’m not duplicating work that has already been done and I am curious where to call said function (maybe in one of the account controller functions?)
    I was hoping that appending &clearCache=1 to the query might help resolve my problem, or the debug options to not use memcache, phpcaching, etc, but none of these seem to do quite what I want.

    Thanks so much in advance,

  • wmike1503

    Search is not working at all – nothing returned on inputting first name, or last name, or full name.

    Also, I tried to add fields to the metadata to search – companyName and account – this just results in the dreaded spinning wheel – nothing happens at all.

    ‘globalSearchAttributeNames’ => array(







    Obviously, the need to have a working search box is essential.

    Any suggestions, anyone, please?

    Many thanks,


  • http://flavertonrodrigu.es/ Flaverton Rodrigues Rosa

    How to insert custom fields in search?