You are here

function taxonomy_menu_get_options in Taxonomy menu 6.3

Used to create a form array of taxonomy menu options invokes hook_taxonomy_menu_options().

Parameters

$op: type of option path/group/item/global

Return value

$form array

2 calls to taxonomy_menu_get_options()
taxonomy_menu_group_form in ./taxonomy_menu.admin.inc
Implementation of hook_form().
taxonomy_menu_term_set_form in ./taxonomy_menu.admin.inc
Implementation of hook_form(). Add Term Set form.

File

./taxonomy_menu.module, line 230
It Generates menu links for all selected taxonomy terms

Code

function taxonomy_menu_get_options($op, $type_key) {
  $options = module_invoke_all('taxonomy_menu_options');

  //cycle through field
  foreach ($options as $field_name => $field_elements) {
    if ($op == $field_elements['option_type']) {

      // If the option type if path, then check the path option
      if ($op == 'PATH') {

        // set the default path type
        $type_key = $type_key ? $type_key : 'taxonomy_menu_path_default';
        if ($field_elements['taxonomy_menu_path'] == $type_key) {
          _taxonomy_menu_get_options($options, $field_name, $op, $type_key);
        }
        else {
          unset($options[$field_name]);
        }
      }
      else {
        if ($op != 'PATH') {
          _taxonomy_menu_get_options($options, $field_name, $op, $type_key);
        }
        else {
          unset($options[$field_name]);
        }
      }
    }
    else {

      //unset the options that are not part of the selected op
      unset($options[$field_name]);
    }
  }

  //set the option feildset values
  $options['#type'] = 'fieldset';
  $options['#title'] = t('Options');
  $options['#collapsible'] = TRUE;
  $options['#tree'] = TRUE;
  return $options;
}