You are here

function menu_badges_standardize_format in Menu Badges 7

Standardize the format for people who may be using the initial string-based format.

Parameters

$badges:

1 call to menu_badges_standardize_format()
menu_badges_get_badges in ./menu_badges.module
Get all menu badge definitions.

File

./menu_badges.module, line 175
Menu Badges module file.

Code

function menu_badges_standardize_format(&$badges) {
  foreach ($badges as $key => $definition) {
    if (is_string($definition)) {

      // Original hook format.
      $badges[$key] = array(
        'callback' => $key,
        'module' => 'menu_badges',
      );
    }

    // Add module name.
    $module_info = system_get_info('module', $definition['module']);
    $badges[$key]['module_name'] = $module_info['name'];
    $badges[$key]['key'] = $key;
  }
}