You are here

function taxonomy_form_vocabulary in Drupal 5

Same name and namespace in other branches
  1. 4 modules/taxonomy.module \taxonomy_form_vocabulary()
  2. 6 modules/taxonomy/taxonomy.admin.inc \taxonomy_form_vocabulary()
  3. 7 modules/taxonomy/taxonomy.admin.inc \taxonomy_form_vocabulary()

Display form for adding and editing vocabularies.

3 string references to 'taxonomy_form_vocabulary'
forum_form_alter in modules/forum/forum.module
Implementation of hook_form_alter().
taxonomy_admin_vocabulary_edit in modules/taxonomy/taxonomy.module
Page to edit a vocabulary.
taxonomy_menu in modules/taxonomy/taxonomy.module
Implementation of hook_menu().

File

modules/taxonomy/taxonomy.module, line 230
Enables the organization of content into categories.

Code

function taxonomy_form_vocabulary($edit = array()) {
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Vocabulary name'),
    '#default_value' => $edit['name'],
    '#maxlength' => 255,
    '#description' => t('The name for this vocabulary. Example: "Topic".'),
    '#required' => TRUE,
  );
  $form['description'] = array(
    '#type' => 'textarea',
    '#title' => t('Description'),
    '#default_value' => $edit['description'],
    '#description' => t('Description of the vocabulary; can be used by modules.'),
  );
  $form['help'] = array(
    '#type' => 'textfield',
    '#title' => t('Help text'),
    '#maxlength' => 255,
    '#default_value' => $edit['help'],
    '#description' => t('Instructions to present to the user when choosing a term.'),
  );
  $form['nodes'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Types'),
    '#default_value' => $edit['nodes'],
    '#options' => array_map('check_plain', node_get_types('names')),
    '#description' => t('A list of node types you want to associate with this vocabulary.'),
    '#required' => TRUE,
  );
  $form['hierarchy'] = array(
    '#type' => 'radios',
    '#title' => t('Hierarchy'),
    '#default_value' => $edit['hierarchy'],
    '#options' => array(
      t('Disabled'),
      t('Single'),
      t('Multiple'),
    ),
    '#description' => t('Allows <a href="@help-url">a tree-like hierarchy</a> between terms of this vocabulary.', array(
      '@help-url' => url('admin/help/taxonomy', NULL, NULL, 'hierarchy'),
    )),
  );
  $form['relations'] = array(
    '#type' => 'checkbox',
    '#title' => t('Related terms'),
    '#default_value' => $edit['relations'],
    '#description' => t('Allows <a href="@help-url">related terms</a> in this vocabulary.', array(
      '@help-url' => url('admin/help/taxonomy', NULL, NULL, 'related-terms'),
    )),
  );
  $form['tags'] = array(
    '#type' => 'checkbox',
    '#title' => t('Free tagging'),
    '#default_value' => $edit['tags'],
    '#description' => t('Content is categorized by typing terms instead of choosing from a list.'),
  );
  $form['multiple'] = array(
    '#type' => 'checkbox',
    '#title' => t('Multiple select'),
    '#default_value' => $edit['multiple'],
    '#description' => t('Allows nodes to have more than one term from this vocabulary (always true for free tagging).'),
  );
  $form['required'] = array(
    '#type' => 'checkbox',
    '#title' => t('Required'),
    '#default_value' => $edit['required'],
    '#description' => t('If enabled, every node <strong>must</strong> have at least one term in this vocabulary.'),
  );
  $form['weight'] = array(
    '#type' => 'weight',
    '#title' => t('Weight'),
    '#default_value' => $edit['weight'],
    '#description' => t('In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  if ($edit['vid']) {
    $form['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
    );
    $form['vid'] = array(
      '#type' => 'value',
      '#value' => $edit['vid'],
    );
    $form['module'] = array(
      '#type' => 'value',
      '#value' => $edit['module'],
    );
  }
  return $form;
}