Some modules (i18n_menu, entity_menu_links) extend the menu_links table schema with new columns. In order to persist those new attributes, I had to patch the includes/features.menu.inc file. Patch to follow.

This is definitely not an extensible way to solve this problem, but the available hooks don't seem to be enough to solve this problem.

The patch at #2 makes no assumptions about the extra fields and is completely extensible.

Your feedback is welcome.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

infojunkie’s picture

Status: Active » Needs review
FileSize
1.09 KB

Patch attached.

infojunkie’s picture

Here is an alternative patch that does not hard-code new columns in the query. Instead, it uses a query tag to allow for query alteration. Third-party modules are free to implement hook_query_features_menu_link_alter to extend the query and return extra fields to be exported.

alexweber’s picture

looks good

infojunkie’s picture

pivica’s picture

I do not see how will patch in #1 help with customized attribute that is also missing in features export - and without it i18n menu items will not work correctly.

Approach in #2 is cool but we then need that hook_query_TAG_alter() some where that will add missing attributes - should it go to features or i18n module?

Anyway I needed same customized fix for D6, I just added that attrib in features_menu_link_load() and problem fixed for i18n menu items.

We should maybe even consider adding customized property by default in features_menu_link_load() because it is core menu property?

infojunkie’s picture

Patch #1 explicitly adds language and uuid attributes to features_menu_link_load(). Patch #2 adds a query tag that allows you to alter the query and add any field you like, in your own module.

pivica’s picture

Yeah I get all that and it is correct.

I am just saying that this patches will not help with customized property and users will still not be able to export i18n menu items because of that. Users should not create custom module to allow this behavior - so this is either i18nmenu or features bug - but similar approach like in this patches can fix this also. I guess customized property export should go into separate issue.

mpotter’s picture

Status: Needs review » Reviewed & tested by the community

I'm going to mark patch #2 as RTBC because I think that's a better approach and then the i18n module should implement the hook to properly add the needed fields to the query.

infojunkie’s picture

Thanks mpotter, that was my thinking too.

hefox’s picture

Status: Reviewed & tested by the community » Fixed

infojunkie's git authorship name is kratib? That through me off "WTf, did I attribute the wrong person?"

infojunkie’s picture

hefox, yes it is. My previous username on d.o :-) Thanks for the commit!

infojunkie’s picture

Project: Features » Internationalization
Version: 7.x-2.x-dev » 7.x-1.x-dev
Component: Menu » Menus
Status: Fixed » Needs review
FileSize
582 bytes

This thread exists to allow saving localization information for menu links within features. Please read the original post to understand the context.

The Features maintainers have committed a patch that allows 3rd party modules to override the loading of menu links as they are being serialized. To complete the cycle, it is now up to i18n_menu to override the loading of menu links with the required attributes, namely language and customized.

Patch attached.

Jose Reyero’s picture

Status: Needs review » Fixed

Nice, committed, thanks.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Update description for patch #2

plach’s picture

Project: Internationalization » Features
Version: 7.x-1.x-dev » 7.x-2.x-dev
Component: Menus » Code
Issue summary: View changes
Status: Closed (fixed) » Reviewed & tested by the community
FileSize
0 bytes

It seems this commit accidentally reverted the commit for patch #2 happened in #10.

Here's a reroll. Setting to RTBC as the change was already reviewed/approved.

plach’s picture

Component: Code » Menu
plach’s picture

FileSize
1.02 KB

Now for reals :)

hefox’s picture

Status: Reviewed & tested by the community » Fixed

thanks, hopefully this will stick this time. oops.

ckng’s picture

Status: Fixed » Active

Tested with i18n_menu:
7.x-2.0:
'customized' & 'language' are not exported.

7.x-2.x-dev (001c0e47e):
'customized' & 'language' are exported but the language bit is wrong, all are 'und', where it should be 'en, 'en-gb' or 'es' in my case.

ckng’s picture

Looks like the export is correct, the language field somehow have been changed to 'und' after going through features export. Possible another features bug?

To reproduce,
- have menu set to Translate and Localize
- add language specific menu items
- export via features, menu items languages are all reset to 'und'

hefox’s picture

Status: Active » Fixed

Open a new issue please

Status: Fixed » Closed (fixed)

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