public function MenuChildren::query in Views Menu Node Children Filter 3.0.x
Same name in this branch
- 3.0.x src/Plugin/views/sort/MenuChildren.php \Drupal\views_menu_children_filter\Plugin\views\sort\MenuChildren::query()
- 3.0.x src/Plugin/views/argument/MenuChildren.php \Drupal\views_menu_children_filter\Plugin\views\argument\MenuChildren::query()
Same name and namespace in other branches
- 8.2 src/Plugin/views/argument/MenuChildren.php \Drupal\views_menu_children_filter\Plugin\views\argument\MenuChildren::query()
- 8 src/Plugin/views/argument/MenuChildren.php \Drupal\views_menu_children_filter\Plugin\views\argument\MenuChildren::query()
Set up the query for this argument.
The argument sent may be found at $this->argument.
Overrides NumericArgument::query
File
- src/
Plugin/ views/ argument/ MenuChildren.php, line 94
Class
- MenuChildren
- A filter to show menu children of a parent menu item
Namespace
Drupal\views_menu_children_filter\Plugin\views\argumentCode
public function query($group_by = FALSE) {
$page_identifier = is_array($this->value) ? reset($this->value) : NULL;
// If we aren't going to filter by a parent, just depend on the
// join that is established in $this::setRelationship().
if (!empty($page_identifier)) {
$menus = $this->options['target_menus'];
// Filter results to children nodes of the node found for the provided page_identifier.
$this
->filterChildrenNodeByParent($this->query, $page_identifier, $menus);
}
elseif (is_null($page_identifier)) {
$this->query
->addWhere(0, 'menu_link_content_data.parent', NULL, 'IS NULL');
}
}