function MenuTreeStorageTest::moveMenuLink

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php \Drupal\KernelTests\Core\Menu\MenuTreeStorageTest::moveMenuLink()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php \Drupal\KernelTests\Core\Menu\MenuTreeStorageTest::moveMenuLink()
  3. 10 core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php \Drupal\KernelTests\Core\Menu\MenuTreeStorageTest::moveMenuLink()

Moves the link with the given ID so it's under a new parent.

Parameters

string $id: The ID of the menu link to move.

string $new_parent: The ID of the new parent link.

2 calls to MenuTreeStorageTest::moveMenuLink()
MenuTreeStorageTest::testMenuDisabledChildLinks in core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php
Tests with disabled child links.
MenuTreeStorageTest::testMenuLinkMoving in core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php
Tests the tree with moving links inside the hierarchy.

File

core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php, line 402

Class

MenuTreeStorageTest
Tests the menu tree storage.

Namespace

Drupal\KernelTests\Core\Menu

Code

protected function moveMenuLink($id, $new_parent) : void {
    $menu_link = $this->treeStorage
        ->load($id);
    $menu_link['parent'] = $new_parent;
    $this->treeStorage
        ->save($menu_link);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.