After I used page manager to create a menu link for a panel, my menu_links table now contains some "zombie" entries created by page manager. I don't know for now is this related or not, but also I can't translate them. None of them.

Below goes a screenshot of a query result with the problematic menu link(s).
IIRC, I got this after these steps:

  1. I created a panel page with 'competition' menu_router path.
  2. Then I enabled "Normal menu entry" with title "Конкурс 2013" for the page
  3. Then I added some children menu items to it
  4. Then I changed my mind and switched off this feature by setting it to "No menu entry"
  5. But when I opened admin/structure/menu/manage/main-menu I saw that the menu link is still there. (Now I feel a sense of deja vu — like I posted about this problem in the issue queue before!)
  6. I clicked "reset" and it suddenly disappeared and all it's children jumped to the root level
  7. Then I re-created this item by hand — entering "Конкурс 2013" in title and 'competition' in path.

Making a long story shorter, this is what I have in menu_links now:

52.png

But in the admin UI I see only 830' link, the other 602 and 604 are not displayed anywhere, but as debugging just discovered — they are selected and processed by _menu_tree_check_access() and menu_link_translate(), these zombie items. As a temporary solution I'm gonna kill them now by hand.

Comments

OnkelTem’s picture

Issue summary: View changes

Updated issue summary.

OnkelTem’s picture

I found the reason why I couldn't translate menu link and this is really cryptic!

[Screenshot-guy Mode On]
See anything? No, it's virgin clean:

27.png

Let's click on "Normal menu entry":

39.png

See the title is not empty? It equals to: "Конкурс 2013", a value which was entered before, when for example, menu link was created but then — deleted. But anyway, looks pretty innocent, right? No, it's not. It is the title of the corresponding "menu_router" item (see the column to the right):

32.png

Now the menu_router item has the title, then menu_links are loaded by Drupal core, and they got $link['title'] from menu_router item title, and my particular link now has both 'link_title' and 'title' equals to the same value:

array(
..
  'link_title' => 'Конкурс 2013',
  'title' => 'Конкурс 2013',
)

I'm yet to get around to the actual reason why this makes i18n to stop finding this as a translatable "menu" item string, but for example _menu_item_localize() makes difference:

code

i.e. when title = link_title, it behaves differently.

[Screenshot-guy Mode Off]

IMHO, the 'hidden' naming of menu_router item by page manager is the bug. Steps to reproduce:

1) Open a panel
2) Enable "Normal menu entry" but don't save the panel!
3) Enter the title
4) Now switch it back to "No menu entry"
5) Save the panel
6) menu_router item is updated and got the title.

OnkelTem’s picture

While this has no relation to CTools, just to finish the story, I found the code responsible for not allowing my link translation. It is from i18n_menu.module:

/**
 * Get localizable properties for menu link checking agains the router item.
 */
function _i18n_menu_link_localizable_properties($link) {
  $props = array();
  $router = !empty($link['router_path']) ? _i18n_menu_get_router($link['router_path']) : NULL;
  if (!empty($link['link_title'])) {
    // If the title callback is 't' and the link title matches the router title
    // it will be localized by core, not by i18n_menu.
    if (!$router ||
        (empty($router['title_callback']) || $router['title_callback'] != 't') ||
        (empty($router['title']) || $router['title'] != $link['link_title'])
    ) {
      $props[] = 'title';
    }
  }
  if (!empty($link['options']['attributes']['title'])) {
    // If the description matches the router description, it will be localized
    // by core.
    if (!$router || empty($router['description']) || $router['description'] != $link['options']['attributes']['title']) {
      $props[] = 'description';
    }
  }
  return $props;
}

i.e. if a menu link title matches router title it's not added to the strings of i18n_menu.

OnkelTem’s picture

Issue summary: View changes

Updated issue summary.

japerry’s picture

Status: Active » Closed (outdated)

Drupal 7 is no longer supported, closing.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.