You are here

function _services_menu_serialize_data in Services Menu 7

Serializes the menu tree data.

Parameters

$data: A fully built menu tree

Return value

Serialized menu array

1 call to _services_menu_serialize_data()
_services_menu_retrieve in ./services_menu.resource.inc
Callback for retrieving menu resources.

File

./services_menu.resource.inc, line 37

Code

function _services_menu_serialize_data($data) {
  $result = array();
  foreach ($data as $item_key => $item_value) {
    $item = new ServicesMenuItem();
    foreach ($item->link as $link_key => $link_value) {
      if (isset($item_value['link'][$link_key])) {
        $item->link->{$link_key} = $item_value['link'][$link_key];
      }
    }
    $item->link->path = $item_value['link']['link_path'];
    $item->link->path_alias = drupal_lookup_path('alias', $item->link->path);
    if (isset($item_value['below'])) {
      $item->children = _services_menu_serialize_data($item_value['below']);
    }
    $result[$item->link->title . ' | ' . $item->link->mlid] = $item;
  }
  return $result;
}