Support from Acquia helps fund testing for Drupal Acquia logo

Comments

antondavidsen’s picture

kmajzlik’s picture

Does not work for me because i have update 7102 already in code...

reaperdk@boss’s picture

Hi guys!

@karlos007
You can use command below to perform update 7101:
drush eval "require('sites/all/modules/contrib/menu_position/menu_position.install'); menu_position_update_7101();"

@antondavidsen
Your patch is working great, thank you!

reaperdk@boss’s picture

Unfortunately there is one bug. When you export rules, delete and create one entry with that same rule name then after reverting module an error will occur. It is because in _menu_position_save_field() function condition should be unique machine_name, not rid (which will be incremented for new entry).

sam.spinoy@gmail.com’s picture

Both patches don't work properly, one should be able to run them against the latest dev version.

First patch doesn't work because, like karlos007 says, it uses an update hook lower than the one already in code.
Second patch fails when I try to apply it via drush.

reaperdk@boss’s picture

Second update may fail for you because of different paths. I fixed paths in this latest patch.

Still this command is needed.
drush eval "require('sites/all/modules/contrib/menu_position/menu_position.install'); menu_position_update_7101();

This number of update was omitted when update 7102 was created, that's why now it is used.

@samspinoy
This fix works great for me. Please let me know, if you still have a problem.

reaperdk@boss’s picture

Status: Active » Needs review
sam.spinoy@gmail.com’s picture

Why don't you just use 7103, not everyone will know how to use drush.

reaperdk@boss’s picture

You're right that not everyone will know how to use drush and not everyone will notice that some manual action will be needed.

In latest patch I changed update number 7103.

reaperdk@boss’s picture

Do not use patch #9. There are incorrect paths.

Tomáš Fejfar’s picture

I tried to apply the #10 patch. Works fine on my machine. I can create feature, feature is transferred and the rule is created on the other machine. Except it does not work afterwards. When we tried to re-save it (just in case), we're getting:

Notice: Undefined index: link_path in user_menu_link_alter() (line 1894 of C:\projects\s24\cl-branch\web\modules\user\user.module).
    Notice: Undefined index: link_path in user_menu_link_alter() (line 1900 of C:\projects\s24\cl-branch\web\modules\user\user.module).
    Notice: Undefined index: link_path in menu_link_save() (line 3080 of C:\projects\s24\cl-branch\web\includes\menu.inc).
    Notice: Undefined index: link_path in menu_link_save() (line 3080 of C:\projects\s24\cl-branch\web\includes\menu.inc).
    Notice: Undefined index: link_path in menu_link_save() (line 3123 of C:\projects\s24\cl-branch\web\includes\menu.inc).
    PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'link_path' cannot be null: INSERT INTO {menu_links} (menu_name, plid, link_path, hidden, external, has_children, expanded, weight, module, link_title, options, customized, updated) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12); Array ( [:db_insert_placeholder_0] => navigation [:db_insert_placeholder_1] => 0 [:db_insert_placeholder_2] => [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 0 [:db_insert_placeholder_7] => 0 [:db_insert_placeholder_8] => menu [:db_insert_placeholder_9] => [:db_insert_placeholder_10] => a:1:{s:5:"alter";b:0;} [:db_insert_placeholder_11] => 0 [:db_insert_placeholder_12] => 0 ) in menu_link_save() (line 3135 of C:\projects\s24\cl-branch\web\includes\menu.inc).

The rule uses "content-type: news | taxonomy: site-area | taxonomy value: site-1". I checked that the module is enabled, the rule is created, the taxonomy we're using is there (same ID even).

The feature itself exports:

/**
 * Implements hook_menu_position_export_fields().
 */
function news_feature_menu_position_export_fields() {
  $items = array(
    'menu_position_test_news' => array(
      'rid' => 1,
      'admin_title' => 'Test news',
      'enabled' => 1,
      'conditions' => 'a:2:{s:12:"content_type";a:1:{s:12:"content_type";a:1:{s:4:"news";s:4:"news";}}s:8:"taxonomy";a:2:{s:3:"vid";s:1:"2";s:3:"tid";a:1:{i:0;s:1:"1";}}}',
      'menu_name' => 'main-menu',
      'plid' => 517,
      'mlid' => 555,
      'weight' => 0,
      'machine_name' => 'menu_position_test_news',
    ),
  );
  return $items;
}
joep.hendrix’s picture

It would be great if we could get this going.
Any news on this?

vinmassaro’s picture

@joep.hendrix: Please see the patch in #10 - can you test it out and provide any feedback?

MustangGB’s picture

#10 worked for me and fixed my feature not being able to revert.

BarisW’s picture

Thanks all for the groundworks. I've used a lot of the code, but rewrote large chunks of it.
Main changes:

  1. Added all code to a menu_position.features.inc to keep the .module file clean.
  2. Simplified _menu_position_save_rule().
  3. Added a #machine_name field in the admin interface

  • BarisW committed 7c8d478 on 7.x-1.x
    Issue #2368121 by reaperdk@boss, antondavidsen, BarisW: Allow support...
BarisW’s picture

Status: Needs review » Fixed

Also, I fixed reverting the feature, since this didn't work. Thanks again! Committed.

Status: Fixed » Closed (fixed)

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