You are here

protected static function MenuChildren::getUrlFromFilterInput in Views Menu Node Children Filter 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/argument/MenuChildren.php \Drupal\views_menu_children_filter\Plugin\views\argument\MenuChildren::getUrlFromFilterInput()
  2. 3.0.x src/Plugin/views/argument/MenuChildren.php \Drupal\views_menu_children_filter\Plugin\views\argument\MenuChildren::getUrlFromFilterInput()

Gets a Url based on the provided user input. Could be either a Node Id, or a menu entry path.

Parameters

string|integer $input The routable url path, or node ID. I.e.:: node/100 (Supports an integer to default to node/%)

Return value

Url The Url object representing the parent entity

1 call to MenuChildren::getUrlFromFilterInput()
MenuChildren::filterChildrenNodeByParent in src/Plugin/views/argument/MenuChildren.php
Filter results to child nodes of a MenuLink found by the $parent_page_identifier.

File

src/Plugin/views/argument/MenuChildren.php, line 261

Class

MenuChildren
A filter to show menu children of a parent menu item

Namespace

Drupal\views_menu_children_filter\Plugin\views\argument

Code

protected static function getUrlFromFilterInput($input) {
  if (is_numeric($input)) {
    $url = Url::fromRoute('entity.node.canonical', [
      'node' => $input,
    ]);
  }
  else {
    $url = Url::fromUserInput('/' . trim($input, '/'));
  }
  return $url;
}