You are here

function ctools_term_settings_form in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 plugins/arguments/term.inc \ctools_term_settings_form()

Settings form for the argument.

1 string reference to 'ctools_term_settings_form'
term.inc in plugins/arguments/term.inc
Plugin to provide an argument handler for a Taxonomy term.

File

plugins/arguments/term.inc, line 96
Plugin to provide an argument handler for a Taxonomy term.

Code

function ctools_term_settings_form(&$form, &$form_state, $conf) {

  // @todo allow synonym use like Views does.
  $form['settings']['input_form'] = array(
    '#title' => t('Argument type'),
    '#type' => 'radios',
    '#options' => array(
      'tid' => t('Term ID'),
      'term' => t('Term name'),
    ),
    '#default_value' => $conf['input_form'],
    '#prefix' => '<div class="clearfix">',
    '#suffix' => '</div>',
  );
  $vocabularies = taxonomy_get_vocabularies();
  $options = array();
  foreach ($vocabularies as $vid => $vocab) {
    $options[$vocab->machine_name] = $vocab->name;
  }

  // Fallback on legacy 'vids', when no vocabularies are available.
  if (empty($conf['vocabularies']) && !empty($conf['vids'])) {
    $conf['vocabularies'] = _ctools_term_vocabulary_machine_name_convert(array_filter($conf['vids']));
    unset($conf['vids']);
  }
  $form['settings']['vocabularies'] = array(
    '#title' => t('Limit to these vocabularies'),
    '#type' => 'checkboxes',
    '#options' => $options,
    '#default_value' => !empty($conf['vocabularies']) ? $conf['vocabularies'] : array(),
    '#description' => t('If no vocabularies are checked, terms from all vocabularies will be accepted.'),
  );
  $form['settings']['breadcrumb'] = array(
    '#title' => t('Inject hierarchy into breadcrumb trail'),
    '#type' => 'checkbox',
    '#default_value' => !empty($conf['breadcrumb']),
    '#description' => t('If checked, taxonomy term parents will appear in the breadcrumb trail.'),
  );
  $form['settings']['transform'] = array(
    '#title' => t('Transform dashes in URL to spaces in term name filter values'),
    '#type' => 'checkbox',
    '#default_value' => !empty($conf['transform']),
  );
}