You are here

function devel_generate_term_form in Devel 7

Generates taxonomy terms using FormAPI.

1 call to devel_generate_term_form()
DevelGenerateTest::testGenerate in devel_generate/devel_generate.test
Tests generate commands
1 string reference to 'devel_generate_term_form'
devel_generate_menu in devel_generate/devel_generate.module
Implements hook_menu().

File

devel_generate/devel_generate.module, line 267

Code

function devel_generate_term_form() {
  $options = array();
  foreach (taxonomy_get_vocabularies() as $vid => $vocab) {
    $options[$vid] = $vocab->machine_name;
  }
  $form['vids'] = array(
    '#type' => 'select',
    '#multiple' => TRUE,
    '#title' => t('Vocabularies'),
    '#required' => TRUE,
    '#options' => $options,
    '#description' => t('Restrict terms to these vocabularies.'),
  );
  $form['num_terms'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of terms?'),
    '#default_value' => 10,
    '#size' => 10,
  );
  $form['title_length'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum number of characters in term names'),
    '#default_value' => 12,
    '#size' => 10,
  );
  $form['kill_taxonomy'] = array(
    '#type' => 'checkbox',
    '#title' => t('Delete existing terms in specified vocabularies before generating new terms.'),
    '#default_value' => FALSE,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Generate'),
  );
  return $form;
}