There seems to be a problem (actually 2) with creating the 'Browse by' category, name, date tabs when using the taxonomy module for a project.
The first is that the project_sort_method creates the array with the key as the method and the value as 'project'. The iterator is retrieving the value as the sort_method. This prevents the tabs from being created.
The original code is:
foreach ($term_methods as $sort_method) {
...
}
It should be:
foreach ($term_methods as $sort_method => $sort_type) {
...
}
The second problem is that the 'type' key in the array is sometimes producing the MENU_DEFAULT_LOCAL_TASK for two items. This causes invalid html to be produced.
The original 'type' part is:
'type' => (($sort_method == variable_get('project_sort_method', 'category') || (($j == 0) && !in_array(variable_get('project_sort_method', 'category'), $term_methods))) ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK),
It can be simplified (i think) to:
'type' => (($sort_method == variable_get('project_sort_method', 'category')) ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK),
The final block should read:
foreach ($term_methods as $sort_method => $sort_type) {
$items[] = array('path' => 'project/' . $term->name . '/'. $sort_method,
'title' => t('Browse by !sort_method', array('!sort_method' => $sort_method)),
'access' => $access,
'type' => (($sort_method == variable_get('project_sort_method', 'category')) ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK),
'weight' => ($sort_method == variable_get('project_sort_method', 'category')) ? -10 : $j,
'callback arguments' => array($term->name, $sort_method));
$j++;
}
I have attached a patch with the proposed changes.
| Comment | File | Size | Author |
|---|---|---|---|
| project_module_0.patch | 1.26 KB | swood |
Comments
Comment #1
dwwthanks for the patch, i'll take a look when i get the chance.
Comment #2
hunmonk commentedthis was either already fixed awhile back, or it wasn't ever a problem.