Posted by Kiphaas7 on July 25, 2009 at 10:47pm
8 followers
| Project: | Basic |
| Version: | 6.x-2.6 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | couzinhub |
| Status: | closed (won't fix) |
Issue Summary
First of all, great theme framework! I love the simple basic ( ;-) ) setup.
I made a little modification to the tab function. It adds a class to the primary tabs if there is a secondary tab list. I needed it in my case to do some different styling to the primary tabs. Not exactly rocket science, but a worthy addition (imho).
Instead of:
<?php
function basic_menu_local_tasks() {
$output = '';
if ($primary = menu_primary_local_tasks()) {
$output .= "<ul class=\"tabs primary clear-block\">\n". $primary ."</ul>\n";
}
if ($secondary = menu_secondary_local_tasks()) {
$output .= "<ul class=\"tabs secondary clear-block\">\n". $secondary ."</ul>\n";
}
return $output;
}
?>Do this:
<?php
function basic_menu_local_tasks() {
$output = '';
if ($primary = menu_primary_local_tasks()) {
if(menu_secondary_local_tasks()) {
$output .= "<ul class=\"tabs primary primary-with-secondary clear-block\">\n". $primary ."</ul>\n";
}
else {
$output .= "<ul class=\"tabs primary clear-block\">\n". $primary ."</ul>\n";
}
}
if ($secondary = menu_secondary_local_tasks()) {
$output .= "<ul class=\"tabs secondary clear-block\">\n". $secondary ."</ul>\n";
}
return $output;
}
?>
Comments
#1
Argh, a more semantic class name would obviously be "with-secondary" instead of "primary-with-secondary". We already know it's primary :).
Modified function again:
<?php
function basic_menu_local_tasks() {
$output = '';
if ($primary = menu_primary_local_tasks()) {
if(menu_secondary_local_tasks()) {
$output .= "<ul class=\"tabs primary with-secondary clear-block\">\n". $primary ."</ul>\n";
}
else {
$output .= "<ul class=\"tabs primary clear-block\">\n". $primary ."</ul>\n";
}
}
if ($secondary = menu_secondary_local_tasks()) {
$output .= "<ul class=\"tabs secondary clear-block\">\n". $secondary ."</ul>\n";
}
return $output;
}
?>
#2
#3
Automatically closed -- issue fixed for 2 weeks with no activity.
#4
Not good idea.
I had to remove this function from template.php. Cause I had problems with tabs using Panels module ( tabs "Edit panel" , "view" were not visible)
#5
CSS class collision? Do you also get this with the original function? If not, what part of the modified function makes it break down?
#6
@Kiphaas7
If you make custom page using Panels do you have these tabs edit and view in basic theme?
(I mean the ones in attached picture)
#7
Same prob here as @Oleksa.
and the answer to @Oleksa is yes.
#8
in my page.tpl.php I just added
<?php if (!empty($tabs)): ?><div id="tabs-wrapper" class="tabs-wrapper <?php if ($secondary = menu_secondary_local_tasks()): ?>secondary<?php endif; ?>"><?php print $tabs; ?></div><?php endif; ?>not pretty but hey whatever.
#9
<?php
/**
* Duplicate of theme_menu_local_tasks() but adds clearfix to tabs.
*/
function basic_menu_local_tasks() {
$output = '';
// CTools requires a different set of local task functions.
if (module_exists('ctools')) {
ctools_include('menu');
$primary = ctools_menu_primary_local_tasks();
$secondary = ctools_menu_secondary_local_tasks();
}
else {
$primary = menu_primary_local_tasks();
$secondary = menu_secondary_local_tasks();
}
if ($primary) {
$output .= '<ul class="tabs primary clearfix">' . $primary . '</ul>';
}
if ($secondary) {
$output .= '<ul class="tabs secondary clearfix">' . $secondary . '</ul>';
}
return $output;
}
?>
#10
@Oleska: yes, this solution was exactly the same I found out a while ago.
@SteveK: Hello maintainer ! I like this theme a lot, used it in many sites and wondered since a long time about the lack of the Edit Panel Button.
** Please ** put this piece of code in the template.php
Greetings from Hamburg !
#11
Hi kle, I'm not sure this should be in the basic theme as it isn't really a fundamental. It is only applying to panels users, which isn't everyone I'm afraid :)
#12