function MenuUiTest::disableMenuLink

Same name in other branches
  1. 8.9.x core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::disableMenuLink()
  2. 10 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::disableMenuLink()
  3. 11.x 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.

2 calls to MenuUiTest::disableMenuLink()
MenuUiTest::doMenuTests in core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
Tests menu functionality.
MenuUiTest::toggleMenuLink in core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
Alternately disables and enables a menu link.

File

core/modules/menu_ui/tests/src/Functional/MenuUiTest.php, line 936

Class

MenuUiTest
Tests the menu UI.

Namespace

Drupal\Tests\menu_ui\Functional

Code

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());
}

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