0

i have a hierarchical list of organizations and a module that performs actions to an organization. my task is to build a page where a menu tree of organizations is placed on the left side and the module is on center. what is the best way to implement this?

my current suggestion is to make links in the form of "organization/$orgid" and make the module hook_menu() wildcards. but the problem is that i can't assign wildcard paths when creating a menu item.

maybe i should use taxonomy?

1 Answer 1

4

You could use taxonomy for the organizations and use the following modules:

  • taxonomy_menu to generate menu items automatically for the taxonomy tree.
  • menu_block to render the menu items in different ways
  • views to manipulate the output

Using the *hook_taxonomy_menu_path* you can control what paths the menu items use that get generated using the *taxonomy_menu* module.

<?php

function mymodule_taxonomy_menu_path() {
  $output = array(
                  'mymodule_path_organizations' => t('Organization'),
                 );

  return $output;
}

function mymodule_path_organizations($vid, $tid) {
  if ($tid == 0) {
    //get all of the terms for the vocab
    $vtids = _taxonomy_menu_get_terms($vid);
    $end = implode(' ', $vtids);
    $path = "taxonomy-orgs/term/$end";
  }
  else {
    $path = 'taxonomy-orgs/term/' . $tid;
  }

  return $path;
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.