function MenuUiTest::enableMenuLink

Same name in other branches
  1. 9 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::enableMenuLink()
  2. 8.9.x core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::enableMenuLink()
  3. 10 core/modules/menu_ui/tests/src/Functional/MenuUiTest.php \Drupal\Tests\menu_ui\Functional\MenuUiTest::enableMenuLink()

Enables a menu link.

Parameters

\Drupal\menu_link_content\Entity\MenuLinkContent $item: Menu link.

1 call to MenuUiTest::enableMenuLink()
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 1043

Class

MenuUiTest
Tests the menu UI.

Namespace

Drupal\Tests\menu_ui\Functional

Code

public function enableMenuLink(MenuLinkContent $item) : void {
    $menu_link_id = $item->id();
    $edit['enabled[value]'] = TRUE;
    $this->drupalGet("admin/structure/menu/item/{$menu_link_id}/edit");
    $this->submitForm($edit, 'Save');
    // Verify in the database.
    $this->assertMenuLink([
        'enabled' => 1,
    ], $item->getPluginId());
}

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