If url contains language prefix, parent_candidates will also and will not be found in menu_links table.

In the last commit there is a change in
function menu_trail_by_path_init() {
- $parent_candidates = _get_parent_candidates(drupal_get_path_alias());
+ $parent_candidates = _menu_trail_by_path_get_parent_candidates();

which I guess is the cause, because if I put back drupal_get_path_alias() everything works fine again.
Thanks.

Comments

opi’s picture

It's because _menu_trail_by_path_get_parent_candidates() call request_path(); which return the full path, with language prefix.
I think _menu_trail_by_path_get_parent_candidates() should call drupal_get_path_alias() instead.

guillaumev’s picture

Status: Active » Needs review
StatusFileSize
new455 bytes

I just tested what was described in comment #1 and it works. I created a patch for this.

guillaumev’s picture

StatusFileSize
new1.59 KB

I went too fast. Changing request_path by drupal_get_path_alias works, in fact, but items in the breadcrumb are not translated. Here is a patch that fixes this...

guillaumev’s picture

StatusFileSize
new1.53 KB

For impatient people like myself, here is a patch that works with RC2.

SeriousMatters’s picture

I admit I'm not very familiar with i18n (Locale is all I used for multilingual sites). Can we have more review/testing?

mxt’s picture

Patch provided in #4 works very well for me.

Can this be committed please?

Thank you very much.

design.er’s picture

Patch #4 works perfectly on my i18n site. Thanks a lot! :)

yurg’s picture

#4 works for multilingual site, active-classes weren't set until patch was applied. Thanks!

mxt’s picture

Status: Needs review » Reviewed & tested by the community

I think 3 positive responses are enough.

Can this be committed please?

jurgenr’s picture

+1 to commit.
Patch works perfectly.

Jurgen.

SeriousMatters’s picture

Version: 7.x-2.0-rc2 » 7.x-2.x-dev
Status: Reviewed & tested by the community » Fixed

committed and pushed.

guillaumev++

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

caspercash’s picture

I can't see this patch

  function _menu_trail_by_path_get_parent_candidates($path = NULL) {
   if (!isset($path)) {
-    $path = request_path();
+    $path = drupal_get_path_alias();
   }
   $pieces = explode('/', $path);
   $path = ''; 

implemented in the 7.x-2.x-dev version neither in the 7.x-2.0-rc2.

guillaumev’s picture

Here is a link to the commit: http://drupalcode.org/project/menu_trail_by_path.git/blobdiff/928086b4a4...

It seems like the module maintainer chose a different solution than what I proposed in the patch, but still a valid one, which is available in 7.x-2.x-dev

lpalgarvio’s picture

please publish the new version.
thanks =)

lpalgarvio’s picture

hum, i'm not really sure this is working...

#1271152: Menu collapses on node pages?

SeriousMatters’s picture

LPCA, This issue is about path with language prefix. If you have a different problem, please open a new support request / bug report issue. Remember to describe the steps to reproduce your problem.