disableMenuLink example

 $item3->getPluginId());

    // Add 102 menu links with increasing weights, then make sure the last-added     // item's weight doesn't get changed because of the old hardcoded delta=50.     $items = [];
    for ($i = -50; $i <= 51; $i++) {
      $items[$i] = $this->addMenuLink('', '/node/' . $node1->id()$menu_name, TRUE, strval($i));
    }
    $this->assertMenuLink(['weight' => '51']$items[51]->getPluginId());

    // Disable a link and then re-enable the link via the overview form.     $this->disableMenuLink($item1);
    $edit = [];
    $edit['links[menu_plugin_id:' . $item1->getPluginId() . '][enabled]'] = TRUE;
    $this->drupalGet('admin/structure/menu/manage/' . $item1->getMenuName());
    $this->submitForm($edit, 'Save');

    // Mark item2, item4 and item5 as expanded.     // This is done in order to show them on the frontpage.     $item2->expanded->value = 1;
    $item2->save();
    $item4->expanded->value = 1;
    $item4->save();
    
Home | Imprint | This part of the site doesn't use cookies.