You are here

function entity_menu_links_services_update in Entity menu links 7

Updates a menu_link and returns the mlid.

Parameters

$mlid: Unique identifier for this menu_link.

$menu_link: An object as would be returned from entity_load().

Return value

Unique identifier for the menu_link (mlid) or FALSE if there was a problem.

1 string reference to 'entity_menu_links_services_update'
entity_menu_links_services_resources in ./entity_menu_links.services.inc
Implements hook_services_resources().

File

./entity_menu_links.services.inc, line 185
Contains callbacks for service resource manipulation.

Code

function entity_menu_links_services_update($mlid, $menu_link) {
  $controller = entity_get_controller('menu_link');
  $menu_link = $controller
    ->create($menu_link);
  $menu_link->mlid = $mlid;
  try {
    $controller
      ->save($menu_link);
  } catch (Exception $e) {
    return services_error(t('Failed to update menu_link @mlid.', array(
      '@mlid' => $mlid,
    )), 500);
  }
  return $mlid;
}