You are here

function _taxonomy_menu_create_options in Taxonomy menu 6.2

Same name and namespace in other branches
  1. 7 taxonomy_menu.module \_taxonomy_menu_create_options()

Creates a form array of taxonomy menu options

Return value

$form array

See also

hook_taxonomy_menu_options()

1 call to _taxonomy_menu_create_options()
taxonomy_menu_form_alter in ./taxonomy_menu.module
Implementation of hook_form_alter().

File

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

Code

function _taxonomy_menu_create_options($vid) {
  $options = module_invoke_all('taxonomy_menu_options');

  // cycle through field
  foreach ($options as $field_name => $field_elements) {

    // cycle through each value of the field
    $variable_name = _taxonomy_menu_build_variable($field_name, $vid);

    // if the variable is set then use that, if the default key is set then use that, otherwise use false
    $options[$field_name]['#default_value'] = variable_get($variable_name, !empty($options[$field_name]['default']) ? $options[$field_name]['default'] : FALSE);

    // set the type to checkbox if it is empty
    if (empty($options[$field_name]['#type'])) {
      $options[$field_name]['#type'] = 'checkbox';
    }

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

    // remove the default value from the array so we don't pass it to the form
    unset($options[$field_name]['default']);
  }
  return $options;
}