Any Menu Path currently stores the affected mlids in a Drupal variable. This can be exported with Features, but the mlids won't necessarily match on the target site. This has the unfortunate effect of causing exported menu links to flat-out not show up on target sites.
I propose that we store menu items that are affected by Any Menu Path the same way that Features exports menu items so that these two things match up regardless of the site (a sort of pseudo-machine name).
One thing I'm unsure of is what happens if two identical menu items are exported with Features. Will the identifier be the same for both? I assume not, but I'll test this. I think this solution will work well enough for now. (Update: Features can't export two identical menu links. That is not our problem, but since that's how it's working, that is what I'll code against; we don't have to worry about multiple items with the same title AND path right now.)
Ultimately, we should implement CTools exportables, use a database table, and implement something like hook_features_pipe_alter to automatically include relevant Any Menu Path configurations when menu items are going to be exported (and vice-versa).
But that is not the goal of my patch here.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | any_menu_path_2283991_features_3.patch | 10.36 KB | wizonesolutions |
Comments
Comment #1
wizonesolutionsOK, I know why menu items sometimes disappear.
When Features tries to save the link to the database, it's changing
externalback to0— even if it's exported as1. In that case, reverting fails. I'm assuming there's a validation check that is failing and that we need to hook into.They are not really gone; changing
externalto1in themenu_linkstable works around the problem. This will need to be part of our update hook.Coming back to this tomorrow.
Comment #2
wizonesolutionsComment #3
wizonesolutionsAlright! I figured out a decent approach for this.
mlids when the load function is called.Going to test it some more, but here is the patch.