Support from Acquia helps fund testing for Drupal Acquia logo

Comments

skalfyfan’s picture

You can just as easily just use css to hide the generated submenu using display: none.

ayalon’s picture

Thanks for the patch! This should be an option of this module. Disabling the Menu Item via patch is bad but the only solution.

ayalon’s picture

CSS is not an option because the menu item is useless and should not be rendered

keva’s picture

Issue summary: View changes

Thank you for this patch.

Agogo’s picture

This really needs to be an option if not default so one do not have to hack the code to be able to turn of the menu items that shouldnt exist in the first place.

punyaruchal’s picture

Thanks its work nice.

sheise’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Patch (to be ported) » Needs review
FileSize
4.55 KB

Here's a patch to do this more properly with an added option to each rule to display or not.

antims’s picture

Perfect.Thans you,@sheise.

sheise’s picture

Hoping to get more reviews of #7.

BarisW’s picture

Is this related to #2620132: Menu position does not respect "expanded" setting?
Did you check the settings at /admin/structure/menu-position/settings?

sheise’s picture

@BarisW

Wow you are right - this can be easily done at admin/structure/menu-position/settings. How did we all miss those settings??!!

I guess this patch would still be applicable if you wanted to have some menu rules show the active link and other rules not show it. But that might be rare that people would want to have both on the same site.

ayalon’s picture

This feature is much needed. I update the patch for the latest dev and I added also the features export functionality which is missing in the patch

BarisW’s picture

@ayalon; please don't mix issues. The patch you added is already committed to dev in #2640076: Menu position rule in features export causes PDOException during feature revert.

a65162’s picture

a65162’s picture

This patch work for me.

note:when you export menu position setting, then you revert it. maybe you will see some error.
like this :

[error]  PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2055' for key 'PRIMARY' in /Applications/MAMP/htdocs/dct/includes/database/database.inc:2227
Stack trace:
#0 /Applications/MAMP/htdocs/dct/includes/database/database.inc(2227): PDOStatement->execute(Array)
#1 /Applications/MAMP/htdocs/dct/includes/database/database.inc(697): DatabaseStatementBase->execute(Array, Array)
#2 /Applications/MAMP/htdocs/dct/includes/database/mysql/query.inc(36): DatabaseConnection->query('INSERT INTO {me...', Array, Array)
#3 /Applications/MAMP/htdocs/dct/includes/menu.inc(3195): InsertQuery_mysql->execute()
#4 /Applications/MAMP/htdocs/dct/sites/all/modules/contrib/menu_position/menu_position.admin.inc(688): menu_link_save(Array)
#5 /Applications/MAMP/htdocs/dct/sites/all/modules/contrib/menu_position/menu_position.features.inc(95): menu_position_edit_menu_link('1', 6000, 219, '\xE9\x97\x9C\xE6\x96\xBC\xE6\x88\x91\xE5\x80\x91con...')
#6 /Applications/MAMP/htdocs/dct/sites/all/modules/contrib/menu_position/menu_position.features.inc(72): _menu_position_save_rule(Array)
#7 /Applications/MAMP/htdocs/dct/sites/all/modules/contrib/features/features.module(597): menu_position_features_revert('dct_menu_positi...', 'menu_position')
#8 /Applications/MAMP/htdocs/dct/sites/all/modules/contrib/features/features.module(1003): features_invoke('menu_position', 'features_revert', 'dct_menu_positi...')
#9 /Applications/MAMP/htdocs/dct/sites/all/modules/contrib/features/features.module(1024): _features_restore('revert', Array)
#10 /Applications/MAMP/htdocs/dct/sites/all/modules/contrib/features/features.drush.inc(804): features_revert(Array)
#11 /Users/wei/Desktop/drush/includes/command.inc(422): drush_features_revert('dct_menu_positi...', 'tp_webform', 'dct_online_appe...', 'tp_batman_block')
#12 /Users/wei/Desktop/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#13 /Users/wei/Desktop/drush/includes/command.inc(199): drush_command('dct_menu_positi...', 'tp_webform', 'dct_online_appe...', 'tp_batman_block')
#14 /Users/wei/Desktop/drush/includes/command.inc(55): drush_dispatch(Array, Array)
#15 /Applications/MAMP/htdocs/dct/sites/all/modules/contrib/features/features.drush.inc(865): drush_invoke(Array, Array)
#16 /Users/wei/Desktop/drush/includes/command.inc(422): drush_features_revert_all()
#17 /Users/wei/Desktop/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#18 /Users/wei/Desktop/drush/includes/command.inc(199): drush_command()
#19 /Users/wei/Desktop/drush/lib/Drush/Boot/BaseBoot.php(73): drush_dispatch(Array)
#20 /Users/wei/Desktop/drush/includes/preflight.inc(93): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#21 /Users/wei/Desktop/drush/drush.php(11): drush_main()
#22 {main} 

This meaning is menu postition create the menu link that conflict with other menu link (

mlid

!!!!!);
solved : modify your feature componect.