Answer the question
In order to leave comments, you need to log in
How to get the ID of the parent menu item?
Hello. I use Drupal 7.
Please tell me how can I get the ID of the parent menu item?
My menu structure is:
--About
----About Child 1
----About Child 2
----About Child 3
----About Child 4
--Team
--Products
----Product Child 1
----Product Child 2
----Product Child 3
--Contacts
And when I go to the 'About Child 2' page, I need to get the parent's ID. In this case it is 'About'. Child page url is not ' site.com/about/about-child-2 ' but ' site.com/about-child-2 '
I need to get the ID in the 'theme_breadcrumb()' function. Let's say I can get the id of the current page through the 'drupal_get_normal_path()' function, but I can't get the parent menu item any further.
function theme_breadcrumb($variables) {
$breadcrumb = $variables['breadcrumb'];
$current_id = drupal_get_normal_path($_GET['q']);
// дальше не получается. пробовал, но получал только ID главной страницы
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question