function entity_menu_links_services_create in Entity menu links 7
Adds a new menu_link and returns the mlid.
Parameters
$menu_link: An object as would be returned from entity_load().
Return value
Unique identifier for the menu_link (mlid) or errors if there was a problem.
1 string reference to 'entity_menu_links_services_create'
File
- ./
entity_menu_links.services.inc, line 155 - Contains callbacks for service resource manipulation.
Code
function entity_menu_links_services_create($menu_link) {
$controller = entity_get_controller('menu_link');
$menu_link = $controller
->create($menu_link);
if (!empty($menu_link->mlid)) {
unset($menu_link->mlid);
}
try {
$controller
->save($menu_link);
} catch (Exception $e) {
return services_error(t('Failed to create menu_link.'), 500);
}
return array(
'mlid' => $menu_link->mlid,
'uri' => services_resource_uri(array(
'menu_link',
$menu_link->mlid,
)),
);
}