From bf28630a5e46d28d66d604ceea80f53c060e647b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= <gabor@hojtsy.hu>
Date: Mon, 28 Jan 2008 19:09:19 +0000
Subject: [PATCH] #213664 by chx, theborg: menu item not expanded on front page

---
 includes/menu.inc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/includes/menu.inc b/includes/menu.inc
index 618255b8258b..9d2a259af109 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -451,7 +451,7 @@ function _menu_check_access(&$item, $map) {
 
 /**
  * Localize the router item title using t() or another callback.
- * 
+ *
  * Translate the title and description to allow storage of English title
  * strings in the database, yet display of them in the language required
  * by the current user.
@@ -834,7 +834,13 @@ function menu_tree_page_data($menu_name = 'navigation') {
         // Build and run the query, and build the tree.
         if ($item['access']) {
           // Check whether a menu link exists that corresponds to the current path.
-          $parents = db_fetch_array(db_query("SELECT p1, p2, p3, p4, p5, p6, p7, p8 FROM {menu_links} WHERE menu_name = '%s' AND link_path = '%s'", $menu_name, $item['href']));
+          $args = array($menu_name, $item['href']);
+          $placeholders = "'%s'";
+          if (drupal_is_front_page()) {
+            $args[] = '<front>';
+            $placeholders .= ", '%s'";
+          }
+          $parents = db_fetch_array(db_query("SELECT p1, p2, p3, p4, p5, p6, p7, p8 FROM {menu_links} WHERE menu_name = '%s' AND link_path IN (". $placeholders .")", $args));
 
           if (empty($parents)) {
             // If no link exists, we may be on a local task that's not in the links.
-- 
GitLab