You are here

public function MenuUiTest::enableMenuLink in Drupal 8

Same name and namespace in other branches
  1. 9 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 859

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\Functional

Code

public function enableMenuLink(MenuLinkContent $item) {
  $mlid = $item
    ->id();
  $edit['enabled[value]'] = TRUE;
  $this
    ->drupalPostForm("admin/structure/menu/item/{$mlid}/edit", $edit, t('Save'));

  // Verify in the database.
  $this
    ->assertMenuLink([
    'enabled' => 1,
  ], $item
    ->getPluginId());
}