Drupal 7.33 added a "preferred_menu_links" tag to the database query that is used by menu_link_get_preferred() to find the preferred menu link for a given path, to make it easier to alter. See for more #1854134: Add a query tag to the query in menu_link_get_preferred() to allow modules to alter the query.

As i18n_menu overrides this function in the hook_init(), it would be nice to keep the function identical and to have the same tag.

CommentFileSizeAuthor
#1 add_the-2447261-1.patch941 bytesStephaneQ
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

StephaneQ’s picture

Status: Active » Needs review
FileSize
941 bytes

And here is the patch. I also removed the TODO comment.

rikvd’s picture

Status: Needs review » Reviewed & tested by the community

for a half year in production now, to change the sorting behavior. works like a charm

the i18n_menu module turns the sorting arround, the other way that core does, here the code snippet we use to make the highest menu item, the preferred link

function MODULENAME_query_preferred_menu_links_alter(QueryAlterableInterface $query) {
  $query->orderBy('customized', 'ASC');
  $query->orderBy('ml.depth', 'DESC');
}
joseph.olstad’s picture

Status: Reviewed & tested by the community » Needs review

i18n_menu_init was removed today (in the dev branch 7.x-1.x)

it was replaced with:
i18n_menu_query_preferred_menu_links_alter

Please review , see if you still need a patch for this issue now that i18n_menu_init was removed.

For details about the removal, see:
#881322: Multilevel menu fails to create active menu trail with same link_path in different languages

Thanks

StephaneQ’s picture

Status: Needs review » Closed (outdated)

I think we can close this issue :)

drupalfan2’s picture

Is this patch still necessary for latest Drupal 7 version?

ciss’s picture

@drupalfan2 Please stop spamming issues with this question. Instead take the time to read the individual issue comments and check wether a patch has been committed. Others will have to do the same in order to answer your question.

If you still can't figure out wether a patch is required, try to apply it or at least post your own conclusion and ask for someone to verify it. Thanks!

drupalfan2’s picture

Thank you for your answer and sorry for the question.

>>If you still can't figure out wether a patch is required, try to apply it ...

The patch is still appliable. Does this mean that it is still needed? Is there any case where a patch is still appliable but not needed anymore?

ciss’s picture

The patch is still appliable. Does this mean that it is still needed? Is there any case where a patch is still appliable but not needed anymore?

If an issue version is "*-dev" then the patch needs to be applied to the git branch, not a release version. The patch does not apply to the branch because the patch context (the surrounding lines that tell git / patch where to insert or change the lines) is no longer present (take a look at the file in question). See the "Version control" link on the project page for instructions on how to get the most recent development version via git.

In comment #3 @joseph.olstad describes the API change that makes this patch obsolete.

drupalfan2’s picture

Thank you. I will not use dev versions or versions from git. I will use only latest stable version.

So this patch is still appliable but 7.x-1.25 does not need the patch anymore?

ciss’s picture

No, that patch is not applicable, and hasn't been since 7.x-1.15. Since you apparently need the functionality provided by this patch I again encourage you to carefully read the issue comments as well as issue #881322: Multilevel menu fails to create active menu trail with same link_path in different languages that was linked in comment #3 to gain an understanding of the changes that were made. The API change is similar to this patch, but not compatible.

It may feel tedious, but again this is what everybody else would have to do as well to answer your question. I recommend reading issues by starting with the description, then working your way up from the last comment. Pay attention to related issues that might provide more details as well as mentioned/logged commits.

drupalfan2’s picture

The problem seems to be, that 'platform build" (platform.sh) does not output/show any patch error although the patch is not appliable anymore.

platform build output:

W: >> i18n patched with add_the-2447261-1.patch. [ok]

Why no error?

But manually patching with "patch -p1 < add_the-2447261-1.patch" failes.

Is platform.sh not able to recognize patch applying errors?