Details
-
Type: New Feature
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: None
-
Fix Version/s: 1.0
-
Component/s: None
-
Labels:None
Description
We need to implement local task (secondary menu) navigation w/in CiviCRM so that the codebase can be used in multiple CMS environments (e.g. Drupal, Mambo, etc.)
The following localTasks array should be created and assigned to smarty for every page view. If there are no local tasks for that page, the array is empty. Array should be sorted in 'display order' (i.e. by weight).
localTasks[] = array(
'url' => , // full clickable url including query string
'title' => , // translated title
'class' => // value='active' for current local task, else blank
);
All CiviCRM pages and forms will "include" a template to display the local navigation if localTasks array is not empty (via index.tpl) - common/localNav.tpl. Template will output these as an unordered list which can then be styled as desired via css stylesheet. Formatted output sample:
<div class="tabs"><ul class="tabs primary">
<li><a href="civicrm/contact/view">Contact Summary</a></li>
<li><a href="civicrm/contact/view/rel">Relationships</a></li>
<li><a href="civicrm/contact/view/group">Groups</a></li>
<li class="active"><a href="civicrm/contact/view/note" class="active">Notes</a></li>
<li><a href="civicrm/contact/view/tag">Tags</a></li>
<li><a href="civicrm/contact/view/cd">Custom Data</a></li>
<li><a href="civicrm/contact/view/activity">Activity</a></li>
</ul></div>
If we find that we need a 3rd layer for the menu - we could add a "subtasks" item to the localTasks array which would conditionally be empty, or contain an array of sub-tasks using the same structure.
ISSUE: How do we suppress Drupal output of local tasks (so they don't show up twice)? We could just include localNav.tpl conditionally (for Mambo and not for Drupal) - but would be better to use our own nav in both environments since we have better control over dynamic URLs, etc. If we change the current 'type' in the Drupal menu array from LOCAL_TASK to CALLBACK - then that would suppress the Drupal menu output - but maybe other undesirable side-effects. Also, not sure how the DEFAULT_LOCAL_TASK functionality would be migrated if we remove these (would our code just make the 1st item by weight the default?).