public function MenuUiTest::disableMenuLink 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::disableMenuLink()
- 9 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::disableMenuLink()
Disables a menu link.
Parameters
\Drupal\menu_link_content\Entity\MenuLinkContent $item: Menu link.
File
- core/
modules/ menu_ui/ tests/ src/ Functional/ MenuUiTest.php, line 931
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 disableMenuLink(MenuLinkContent $item) {
$mlid = $item
->id();
$edit['enabled[value]'] = FALSE;
$this
->drupalGet("admin/structure/menu/item/{$mlid}/edit");
$this
->submitForm($edit, 'Save');
// Unlike most other modules, there is no confirmation message displayed.
// Verify in the database.
$this
->assertMenuLink([
'enabled' => 0,
], $item
->getPluginId());
}