By mixhael on
I want to remove the local-tasks tabs and let them appear in the exact same manner as when you hover over a block in Drupal7 and a neat configuration dropdown menu appears where you can click on plus the defined block gets a dotted border.
I figured that the main css-theming will be done once you assign the proper css classes to the wrappers, ul and li's of the local tasks menu. So I modified theme_menu_local_tasks in the following way:
function guerrillabyt_es_menu_local_tasks(&$variables) {
$output = '';
if (!empty($variables['primary'])) {
$variables['primary']['#prefix'] = '<h2 class="element-invisible">' . t('Primary tabs') . '</h2>';
$variables['primary']['#prefix'] .= '<a class="contextual-links-trigger" href="#">Configure</a>';
$variables['primary']['#prefix'] .= '<div class="contextual-links-wrapper contextual-links-processed">';
$variables['primary']['#prefix'] .= '<ul class="contextual-links" style="display:none;">';
$variables['primary']['#suffix'] = '</ul></div>';
$output .= drupal_render($variables['primary']);
}
if (!empty($variables['secondary'])) {
$variables['secondary']['#prefix'] = '<h2 class="element-invisible">' . t('Secondary tabs') . '</h2>';
$variables['secondary']['#prefix'] .= '<a class="contextual-links-trigger" href="#">Configure</a>';
$variables['secondary']['#prefix'] .= '<div class="contextual-links-wrapper contextual-links-processed">';
$variables['secondary']['#prefix'] .= '<ul class="contextual-links" style="display:none;">';
$variables['secondary']['#suffix'] = '</ul></div>';
$output .= drupal_render($variables['secondary']);
}
return $output;
}This works in the sense that markup changes, but the hover-over dropdown behavior isn't added to the specified content-type region.
It's my first time delving into the code of Drupal, so any help in the right directions would be appreciated.
Comments
Anyone?
Anyone?
Ok, managed to do it myself
Ok, managed to do it myself *happy dance*
For anyone who's interested. The tabs are now a dropdown menu, similar to the 'configure block' contextual dropdown menu and will be shown when hovered over the title (screenshot):
added this to template.php of my theme (change 'mytheme' to your theme-name):
Then added a custom region--content.tpl.php template to my templates directory (my theme is based on Omega) and replaced:
<h1 class="title" id="page-title"><?php print $title; ?></h1>with
Help me implement solution in Adaptive based theme
I tried implementing your solution but I'm facing challenges. My theme is based on Adaptive theme. It doesn't have the region--content.tpl.php file that you mentioned. Also after adding the function mytheme_menu_local_tasks(&$variables) replacing 'mytheme' with my actual theme name, the function is not being executed at all even after clearing the cache.
Can you give me pointers on how to do this in my Adaptive based theme?
--
Chalee
Hi Chalee, I took a quick
Hi Chalee,
I took a quick look at adaptive theme and I think you have to override the node.tpl.php
replace:
with
Let me know if that worked for you
Sorry for late response. The
Sorry for late response. The code above is NOT working.
--
Chalee
Adaptive Theme fix
Hi Chalee,
I've had look at the AT theme. As far as I know D7 has changed $tabs and the code for this is found in page.tpl.php for Adaptive Themes. Try changing the code:
...
with
I think that gets you part of the way there. Let me know if this works for you.
_
That's really awesome-- thanks for posting back your working solution! I never know what to do with those tabs-- i really don't like them, lol.
i have the same situation
i have the same situation like you, using the AT, but it doesn't appear in full node view mode. any idea?
Announcing a Drupal 7 module
Announcing a Drupal 7 module which converts tabs to contextual links.
Module's name: TabsNoMore
URL: http://drupal.org/sandbox/onkeltem/1730244