Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Language setting not taken into account when adding new menu items. It's on "English" in the form but after submitting the new items it's on "All languages" for all added items.
Comments
Comment #1
okokokok CreditAttribution: okokokok commentedFound out that the language is stored correctly if I first change it from English to another language.
Comment #2
donquixote CreditAttribution: donquixote commentedA note to the clueless:
This bug only applies if you have the "Menu Translation" module (i18nmenu) enabled.
(submodule shipped with i18n)
Comment #3
donquixote CreditAttribution: donquixote commentedThe fix is quite simple:
I just need to set the default value for language to an empty string.
However, there is some other stuff I need to take into account for the i18nmenu.
Basically, I have to copy the mechanics from the menu_edit_item form.
This form is modified by
i18nmenu_form_menu_edit_item_alter()
, and gets additional validation and submit callbacks:The i18nmenu_menu_item_update() calls _i18nmenu_update_item(), which calls _i18nmenu_get_item(), which calls tt(), which calls i18nstrings_update_string(), which calls i18nstrings_add_string(), which writes to db tables {locales_source}, {locales_target}, {i18n_strings}. Just so you get an idea..
For the submit mechanics it will probably be enough to call _i18nmenu_update_item() for every new or modified item, after it has been saved.
For validation, I should first add some very basic checks, then I can add i18nmenu_menu_item_prepare_normal_path().
Comment #4
donquixote CreditAttribution: donquixote commentedA new version is on CVS, including:
- the bug fix for language settings
- the bug fix for order of items
- a bunch of new features
- probably some new bugs.
I hope the packaging script will run soon.
Comment #5
donquixote CreditAttribution: donquixote commentedPackaging script has run, and the fixed code can be downloaded with the latest 6.x-1.x snapshot.
Comment #6
donquixote CreditAttribution: donquixote commentedThere is no status "committed to snapshot release", so I set this to "needs review".
Others would set it to "fixed", but I don't like this. It's fixed when it's officially released!
Comment #7
donquixote CreditAttribution: donquixote commented