The modules hook_menu implementation creates menu items at hardcoded locations based on the node type using webform default fields: for example admin/structure/types/manage/webform/webform-fields. This causes the menu items to appear at the root of admin/structure/types/manage, and not as tabs on admin/structure/types/manage/webform. They also do not appear in the correct place within the admin menu toolbar, making navigation confusing.

This because the menu item the module is trying to add new tabs to is admin/structure/types/manage/%node_type, a single item for all content types. The use of a hardcoded content type name in the menu creates a new menu item, rather than adding additional tabs to the existing item. It also causes unexpected URLs where a space is used in the content type name: a content type "Content Type" is managed at admin/structure/types/manage/content_type, but the default fields tab is added at admin/structure/types/manage/content-type/webform-fields.

The Drupal approach is to add a single menu tab for all content types using the existing %node_type placeholder, and then use an access callback to deny access where the content type does not require the new tab. This also causes the tab to appear in the expected place in the menu and the toolbar.

Comments

MrDaleSmith created an issue. See original summary.

mrdalesmith’s picture

Status: Active » Needs review
StatusFileSize
new12.31 KB

Attached is a patch to amend the hook_menu callback to move the tabs.

eddie_c’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @MrDaleSmith. This makes things a lot tidier. It seems to work well for me.

adci_contributor’s picture

Hi, MrDaleSmith !

Sorry for a long time without an answer.
Thank you for helping us make our module better and thanks for your work. We will add your code to our module.
Best regards

adci_contributor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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