You are here

public static function MenuChildren::filterByPage 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::filterByPage()
  2. 3.0.x src/Plugin/views/argument/MenuChildren.php \Drupal\views_menu_children_filter\Plugin\views\argument\MenuChildren::filterByPage()

Filter the query by either a: parent node, page page via its link_path, or null and limit to root nodes.

Parameters

\Drupal\views\Plugin\views\query\Sql $query The $query The query: we're going to alter.

\Drupal\menu_link_content\Plugin\Menu\MenuLinkContent $link The by: parent link.

1 call to MenuChildren::filterByPage()
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 240

Class

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

Namespace

Drupal\views_menu_children_filter\Plugin\views\argument

Code

public static function filterByPage(Sql $query, $link) {
  $parent = isset($link) ? $link
    ->getPluginId() : 0;
  $query
    ->addWhereExpression(0, 'menu_link_content_data.parent = :parent_lid', [
    ':parent_lid' => $parent,
  ]);
}