public function MenuUiTest::moveMenuLink in Drupal 10
Same name and namespace in other branches
- 8 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::moveMenuLink()
- 9 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::moveMenuLink()
Changes the parent of a menu link using the UI.
Parameters
\Drupal\menu_link_content\MenuLinkContent $item: The menu link item to move.
int $parent: The id of the new parent.
string $menu_name: The menu the menu link will be moved to.
File
- core/
modules/ menu_ui/ tests/ src/ Functional/ MenuUiTest.php, line 830
Class
- MenuUiTest
- Add a custom menu, add menu links to the custom menu and Tools menu, check their data, and delete them using the UI.
Namespace
Drupal\Tests\menu_ui\FunctionalCode
public function moveMenuLink(MenuLinkContent $item, $parent, $menu_name) {
$mlid = $item
->id();
$edit = [
'menu_parent' => $menu_name . ':' . $parent,
];
$this
->drupalGet("admin/structure/menu/item/{$mlid}/edit");
$this
->submitForm($edit, 'Save');
$this
->assertSession()
->statusCodeEquals(200);
}