function menu_service_process in Services 6
Same name and namespace in other branches
- 6.2 services/menu_service/menu_service.inc \menu_service_process()
- 7 services/menu_service/menu_service.inc \menu_service_process()
Recursively returns menu items
Parameters
data: Array. The current menu item.
Return value
Array. All children menu items from a given menu item.
1 call to menu_service_process()
- menu_service_get in services/
menu_service/ menu_service.inc - Get the menu from the database.
File
- services/
menu_service/ menu_service.inc, line 34 - Adds a service type for a menu
Code
function menu_service_process($data, $fields) {
$out = array();
if (is_array($data)) {
foreach ($data as $item) {
$tmp = new stdClass();
if ($fields) {
foreach ($fields as $field) {
$tmp->{$field} = $item['link'][$field];
}
}
else {
$tmp = (object) $item['link'];
}
if (!$fields or in_array('path_alias', $fields, TRUE)) {
$tmp->path_alias = drupal_get_path_alias($tmp->link_path);
}
$tmp->children = menu_service_process($item['below'], $fields);
$out[] = $tmp;
}
}
return $out;
}