Issue #1926958 by amateescu, maciej.zgadzaj, dawehner: Fixed (Regression) menu_link_save() no longer returns success/failure to calling functions.
parent
a28d09eb8e
commit
30ea03aaf7
|
@ -82,7 +82,10 @@ class MenuTest extends WebTestBase {
|
||||||
// Verify that a change to the description is saved.
|
// Verify that a change to the description is saved.
|
||||||
$description = $this->randomName(16);
|
$description = $this->randomName(16);
|
||||||
$item['options']['attributes']['title'] = $description;
|
$item['options']['attributes']['title'] = $description;
|
||||||
menu_link_save($item);
|
$return_value = menu_link_save($item);
|
||||||
|
// Save the menu link again to test the return value of the procedural save
|
||||||
|
// helper.
|
||||||
|
$this->assertIdentical($return_value, $item->save(), 'Return value of menu_link_save() is identical to the return value of $menu_link->save().');
|
||||||
$saved_item = entity_load('menu_link', $item['mlid']);
|
$saved_item = entity_load('menu_link', $item['mlid']);
|
||||||
$this->assertEqual($description, $saved_item['options']['attributes']['title'], 'Saving an existing link updates the description (title attribute)');
|
$this->assertEqual($description, $saved_item['options']['attributes']['title'], 'Saving an existing link updates the description (title attribute)');
|
||||||
$this->resetMenuLink($item, $old_title);
|
$this->resetMenuLink($item, $old_title);
|
||||||
|
|
|
@ -115,9 +115,13 @@ function menu_link_delete_multiple(array $mlids, $force = FALSE, $prevent_repare
|
||||||
*
|
*
|
||||||
* @param \Drupal\menu_link\Plugin\Core\Entity\MenuLink $menu_link
|
* @param \Drupal\menu_link\Plugin\Core\Entity\MenuLink $menu_link
|
||||||
* The menu link entity to be saved.
|
* The menu link entity to be saved.
|
||||||
|
*
|
||||||
|
* @return int|bool
|
||||||
|
* Returns SAVED_NEW or SAVED_UPDATED if the save operation succeeded, or
|
||||||
|
* FALSE if it failed.
|
||||||
*/
|
*/
|
||||||
function menu_link_save(MenuLink $menu_link) {
|
function menu_link_save(MenuLink $menu_link) {
|
||||||
$menu_link->save();
|
return $menu_link->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue