You are here

function rules_action_taxonomy_load_vocab_form in Rules 6

Action: Load a vocabulary configuration form.

Related topics

File

rules/modules/taxonomy.rules_forms.inc, line 110
Rules configuration forms for the taxonomy module.

Code

function rules_action_taxonomy_load_vocab_form($settings, &$form, $form_state) {
  $form['settings']['vocabulary'] = array(
    '#type' => 'fieldset',
    '#title' => t('Vocabulary selection'),
  );
  $options = _rules_action_taxonomy_get_vocab();
  $form['settings']['vocabulary']['vocab_select'] = array(
    '#type' => 'select',
    '#title' => t('Select a vocabulary'),
    '#options' => $options,
    '#default_value' => !empty($settings['vocabulary']['vocab_select']) ? $settings['vocabulary']['vocab_select'] : '',
    '#description' => !empty($options) ? t('Select the vocabulary.') : t('There are no existing vocabularies, you should <a href="@add-url">add</a> one.', array(
      '@add-url' => url('admin/content/taxonomy/add/vocabulary'),
    )),
    '#required' => TRUE,
    '#disabled' => empty($options),
  );
  $form['settings']['vocabulary']['vocab_text'] = array(
    '#type' => 'textarea',
    '#title' => t('Select by vocabulary id'),
    '#default_value' => !empty($settings['vocabulary']['vocab_text']) ? $settings['vocabulary']['vocab_text'] : '',
    '#disabled' => empty($options),
    '#description' => t('Optional: Enter the vocabulary id (<em>not the vocabulary name</em>) that should be loaded. If this field is used, the "Select a vocabulary" field will be ignored.'),
  );
}