public static function views_menu_children_argument::filterByParentPage in Views Menu Node Children Filter 7
Filter the query by either a: parent node, page page via its link_path, or null and limit to root nodes.
Parameters
null|string|integer $page_identifier The menu_item table's link_path. I.e.: node/100 (Supports an integer to default to node/%):
string $menu_name The menu's machine name we want to filter by.:
\views_plugin_query $query The query we're going to alter.:
1 call to views_menu_children_argument::filterByParentPage()
- views_menu_children_argument::query in includes/
views_menu_children_argument.inc - Set up the query for this argument.
File
- includes/
views_menu_children_argument.inc, line 118
Class
Code
public static function filterByParentPage($page_identifier, $menu_name, \views_plugin_query $query) {
// If not page identifier is provided, select only root nodes of the menu.
if (empty($page_identifier)) {
$parent['mlid'] = 0;
}
else {
// Convert potential aliases to the system path.
$page_identifier = drupal_get_normal_path($page_identifier);
// Get the parent page menu item details.
$parent = menu_link_get_preferred($page_identifier, $menu_name);
// When a link was not found for the $page_identifier,
// return zero results.
if ($parent === FALSE) {
$parent['mlid'] = -1;
}
}
$query
->add_where_expression(0, 'menu_links.plid = :parent_lid', array(
':parent_lid' => $parent['mlid'],
));
}