function views_menu_children_join::build_join in Views Menu Node Children Filter 7
Build the SQL for the join this object represents.
When possible, try to use table alias instead of table names.
Parameters
SelectQueryInterface $select_query: An Implements SelectQueryInterface.
string $table: The base table to join.
views_plugin_query $view_query: The source query, Implements views_plugin_query.
Overrides views_join::build_join
File
- includes/
views_menu_children_join.inc, line 6
Class
Code
function build_join($select_query, $table, $view_query) {
$condition = "";
$values = array();
for ($i = 0; $i < count($this->prefixes); $i++) {
$condition .= "CONCAT(:prefix_{$i}, node.nid) = menu_links.link_path";
if ($i < count($this->prefixes) - 1) {
$condition .= " OR ";
}
$values[":prefix_{$i}"] = $this->prefixes[$i];
}
$select_query
->addJoin("INNER", "menu_links", "menu_links", $condition, $values);
}