You are here

function menu_workbench_access_load in Workbench Access 7

Implements hook_workbench_access_load().

Load data for a menu.

File

modules/menu.workbench_access.inc, line 210
Menu integration for Workbench Access.

Code

function menu_workbench_access_load($scheme) {
  $data = array();

  // This might be a menu or a single menu item.
  if ($menu = menu_load($scheme['access_id'])) {
    $menu = (object) $menu;
    $data = array(
      'access_id' => $menu->menu_name,
      'name' => $menu->title,
      'description' => $menu->description,
    );
  }
  elseif ($item = menu_link_load($scheme['access_id'])) {
    $item = (object) $item;
    $data = array(
      'access_id' => $item->mlid,
      'name' => $item->link_title,
      'description' => isset($item->options['attribute']['description']) ? $item->options['attribute']['description'] : '',
    );
  }
  return $data;
}