Hi,

First, great theme!

I'm working in a intranet for schools and Rootcandy is global theme. Menu has children and I need "active trail" work fine. I did two changes to template.php for meet this:

1. In function _rootcandy_countmatches(). This function verify how many match between a menu item path with current path. Te problem is that verify any part, so If I have two items foo/bar/list and baz/qux/list, function count "list" as match.


function _rootcandy_countmatches($arrayone, $arraytwo) {
  $matches = 0;
	foreach ($arraytwo as $i => $part) {
		if (!isset($arrayone[$i])) break;
		if ($arrayone[$i] == $part) {
			$matches = $i+1;
		} else {
			break;
		}
	}
  return $matches;
}

2. In function _rootcandy_admin_navigation() I added a Or condition in $key == $match, because in some cases $key also contain "active-trail" string. This allow for example, show node as chidlren of menu (with some modules)


$key_parts = explode(' ', $key);
$key = $key_parts[0];

//....
//....

if ($key == $match || $key_parts[1] == 'active-trail') {
  $id = 'current';
  if (!$icons_disabled && $size) {
    $id = 'current-'. $size;
  }
}

This chanes doesn't affect current functionality but improve control over active trail.

My apologize for my english.

Thanks again for this theme.

Comments

vm’s picture

Title: Improve active trail in Rootcandy navigation » Improvement for active trail in navigation
Status: Active » Needs review
vm’s picture

Version: 6.x-1.8 » 6.x-1.x-dev

moving to -dev which is where new code gets put

sign’s picture

Status: Needs review » Fixed

Thanks Dario, nice addition.

I did change it slightly so there are no notices in php log.
http://drupalcode.org/project/rootcandy.git/commitdiff/32564de?hp=0c8b0e...

Committed to dev

Status: Fixed » Closed (fixed)

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