Skip to content
Snippets Groups Projects
Commit 0bd2e22d authored by Yves Guide's avatar Yves Guide
Browse files

Issue #3475268 : Finding most popular menu should ignore current node

Ignore current menu item based on MenuPluginId
parent 694ccbf1
No related branches found
No related tags found
No related merge requests found
......@@ -267,6 +267,12 @@ function _menu_link_sync_get_most_popular_menu_among_siblings($translation_sourc
$tree = _menu_link_sync_get_tree($translation_source_link->menu_name, '');
$popularity = array();
foreach ($tree as $item) {
// Ignore current source menu items from loop.
// Because drupal will load the Node from cache and $target_language translation
// will contain source translation values.
if( $item->link->getPluginId() == $translation_source_link->getMenuPluginId($translation_source_link->getLangcode())){
continue;
}
// Find out if item has a version in the target language.
$target_link = _menu_link_sync_get_link_for_target_language($item->link->getPluginId(), $target_language);
if (empty($target_link)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment