if (preg_match('!^admin/!', $values['path'])) { // It's an admin path; we only want the top-level path though, not any children if (!isset($links[$module][0]) || !strpos($values['path'], $links[$module][0]['href'])) { $links[$module][] = array('title' => $values['title'], 'href' => $values['path']); } }