You are here

function menu_badges_get_views_badges in Menu Badges 7

Get a list of badges defined by Views.

1 call to menu_badges_get_views_badges()
menu_badges_menu_badges_options in ./menu_badges.module
Implements hook_menu_badges_options().

File

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

Code

function menu_badges_get_views_badges() {
  $options = array();
  if (module_exists('views')) {
    $views = views_get_enabled_views();
    foreach ($views as $view) {
      foreach ($view->display as $display) {
        if ($display->display_plugin == 'menu_badge') {
          $options['views_' . $view->name . '_' . $display->id] = array(
            'callback' => 'menu_badges_execute_view',
            'arguments' => array(
              'view_name' => $view->name,
              'view_display_id' => $display->id,
            ),
            'label' => $view->human_name . ': ' . $display->display_title,
            'module' => 'views',
          );
        }
      }
    }
  }
  return $options;
}