While working on a small module to enable toolbar configuration per role I noticed that its not possible to define tabs for sub-pages of profile/%wysiwyg_profile/edit at the moment (i.e. as on admin/structure/types/manage/%node_type/display).

If we do a tiny rewrite of wysiwyg_menu() this will be possible (without breaking something; or at least I couldn't find something ;) ).

Patch follows ...

Files: 

Comments

Title:Rwrite implementation of hook_menu() to allow sub-pages of profile/editRewrite implementation of hook_menu() to allow sub-pages of profile/edit
Status:Active» Needs review
StatusFileSize
new2.39 KB

And here is the patch ...

StatusFileSize
new24.37 KB

Screenshot of additional tabs that won't be possible without this patch:
2043081-1.png

StatusFileSize
new2.03 KB

+++ b/wysiwyg.admin.incundefined
@@ -517,7 +517,7 @@ function wysiwyg_profile_overview($form, &$form_state) {
-        '#markup' => l(t('Edit'), "admin/config/content/wysiwyg/profile/$id/edit"),
+        '#markup' => l(t('Edit'), "admin/config/content/wysiwyg/profile/$id"),

I'd like to keep this linked to /edit to follow the pattern set by other modules. We don't currently have a way to just "view" a profile without editing it, but maybe that will be useful in the future and I'd like to reserve the non-edit path for that.

+++ b/wysiwyg.moduleundefined
@@ -54,19 +54,21 @@ function wysiwyg_menu() {
-  $items['admin/config/content/wysiwyg/profile/%wysiwyg_profile/edit'] = array(
-    'title' => 'Edit',
+  $items['admin/config/content/wysiwyg/profile/%wysiwyg_profile'] = array(
+    'title' => 'Edit profile',

We need a title callback here. It would make it a lot easier to implement Admin menu's hook_admin_menu_map() later if we simply return the name of the format a profile is attached to here, since that's the primary way to identify a profile.

+++ b/wysiwyg.moduleundefined
@@ -74,10 +76,8 @@ function wysiwyg_menu() {
-    'type' => MENU_LOCAL_TASK,
     'weight' => 10,
+   'type' => MENU_LOCAL_TASK,

No need to move this.

Took the liberty of modifying your patch. What do you think?

Looks great.
I don't care much about how it is done if the result is the same :D

Status:Needs review» Fixed

Committed to 7.x-2.x and 6.x-2.x. with appropriate path changes. Expanded the comment to the title callback to clarify the parameter and return value.

This change will be in the -dev snapshots within 12 hours and it will be part of the next official releases.

Added bonus for D7: Implementation of hook_admin_menu_map().

Thanks for suggesting, patching and testing this!

Status:Fixed» Closed (fixed)

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