Hi,
I have a client site that uses organic groups. There are a few menu items (a couple of views as well as the 'add members' form) grouped as sub-tabs under the title 'admin'.
I have made a little glue module that holds the default views and does some menu_alter stuff to group them all together- /node/1/admin/list /node/2/admin/add_members etc.
The client would like the title of the pages to be "node title Admin", which seems like a fairly simple thing to do by calling drupal_set_title, but I can't come up with a good place to put it.
In menu_alter I can set a title callback to set the title dynamically, but this changes the name of the tab too, which I don't want.
Assuming I want to change this in the module rather than the theme, where would something like this go?
Comments
You can use
You can use drupal_set_title() to set a title without changing the name of the tab... I think. But, it sounds like the page being directed to is a views page, so I don't know if you will be able to use that function. Basically you need to put that function in the callback path.
Actually, you could maybe define an entirely new callback function for the path, set the tab name in hook_menu(), then in your callback function (brand new callback function), use drupal_set_title() to set the title, and then views_embed_view() to embed the destination page into that spot. It would look exactly the same as calling the view directly, but you would be able to set your own path.
All speculation, but you can try it out.
Contact me to contract me for D7 -> D10/11 migrations.
That seems like it would
That seems like it would work, but also seems like a long way to go for such a small thing.
In what manner? It's only a
In what manner? It's only a few lines of code.
Contact me to contract me for D7 -> D10/11 migrations.
I guess it's just a lot more
I guess it's just a lot more than what I hoped would have existed, which is some kind of hook_page_about_to_display_or_whatever() where I could do a quick set title.
Turns out I have larger problems though - the people that implemented the theme had some strange ideas about Best Practices which are getting in the way of just about anything.
But I will probably end up with something like you describe, so thanks.