You are here

function content_taxonomy_options_widget_settings in Content Taxonomy 5

Same name and namespace in other branches
  1. 6.2 content_taxonomy_options.module \content_taxonomy_options_widget_settings()
  2. 6 content_taxonomy_options.module \content_taxonomy_options_widget_settings()

Implementation of hook_widget_settings

File

./content_taxonomy_options.module, line 39
Defines a widget type for content_taxonomy for options

Code

function content_taxonomy_options_widget_settings($op, $widget) {
  if ($widget['type'] == 'content_taxonomy_select' || $widget['widget']['type'] == 'content_taxonomy_select') {
    switch ($op) {
      case 'form':
        $form = array();
        $options_term = array();
        $options_term[0] = '---';
        foreach (taxonomy_get_vocabularies() as $voc) {
          foreach (taxonomy_get_tree($voc->vid) as $term) {
            $options_term[$voc->name][$term->tid] = str_repeat('- ', $term->depth) . $term->name;
          }
        }
        $form['optgroup'] = array(
          '#type' => 'fieldset',
          '#title' => t('OptGroups'),
          '#collapsible' => TRUE,
          '#description' => t(''),
          '#weight' => 10,
        );
        $form['optgroup']['group_tid'] = array(
          '#title' => t('Parent for grouping in first bar'),
          '#type' => 'select',
          '#default_value' => isset($widget['group_tid']) ? $widget['group_tid'] : 0,
          '#options' => $options_term,
        );
        return $form;
      case 'save':
        return array(
          'group_tid',
        );
    }
  }
}