You are here

protected function MenuLinkWeightTestTrait::loadMenuLinkByNode in Menu Link Weight 8

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/MenuLinkWeightTestTrait.php \Drupal\Tests\menu_link_weight\FunctionalJavascript\MenuLinkWeightTestTrait::loadMenuLinkByNode()

Load menu link for a given node.

Parameters

\Drupal\node\NodeInterface $node:

Return value

\Drupal\Core\Menu\MenuLinkInterface|FALSE

1 call to MenuLinkWeightTestTrait::loadMenuLinkByNode()
MenuLinkWeightMenuUiTest::testMenuFunctionality in tests/src/Functional/MenuLinkWeightMenuUiTest.php
Test creating, editing, deleting menu links via menu link form.

File

tests/src/FunctionalJavascript/MenuLinkWeightTestTrait.php, line 31

Class

MenuLinkWeightTestTrait

Namespace

Drupal\Tests\menu_link_weight\FunctionalJavascript

Code

protected function loadMenuLinkByNode(NodeInterface $node) {
  $links = $this->menuLinkManager
    ->loadLinksByRoute($node
    ->toUrl()
    ->getRouteName(), $node
    ->toUrl()
    ->getRouteParameters());
  return !empty($links) ? reset($links) : FALSE;
}