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:

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:

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;
}
CommentFileSizeAuthor
#6 111.JPG7.61 KBOleksa-1
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Kiphaas7’s picture

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:

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;
}
Anonymous’s picture

Version: 6.x-2.4 » 6.x-2.6
Assigned: Unassigned »
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

Oleksa-1’s picture

Status: Closed (fixed) » Active

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)

Kiphaas7’s picture

CSS class collision? Do you also get this with the original function? If not, what part of the modified function makes it break down?

Oleksa-1’s picture

FileSize
7.61 KB

@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)

kundu’s picture

Same prob here as @Oleksa.

and the answer to @Oleksa is yes.

chrislabeard’s picture

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.

Oleksa-1’s picture


/**
 * 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;
}

kle’s picture

@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 !

damiankloip’s picture

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 :)

damiankloip’s picture

Status: Active » Closed (won't fix)