You are here

function term_depth_term_depth_ctools_access_settings in Chaos Tool Suite (ctools) 7

Settings form for the 'term depth' access plugin.

1 string reference to 'term_depth_term_depth_ctools_access_settings'
term_depth.inc in term_depth/plugins/access/term_depth.inc
Plugin to provide access control based upon a parent term.

File

term_depth/plugins/access/term_depth.inc, line 27
Plugin to provide access control based upon a parent term.

Code

function term_depth_term_depth_ctools_access_settings($form, &$form_state, $conf) {
  $vocabularies = taxonomy_get_vocabularies();
  $options = array();

  // Loop over each of the configured vocabularies.
  foreach ($vocabularies as $vid => $vocab) {
    $options[$vocab->machine_name] = $vocab->name;
  }
  _term_depth_convert_config_vid_to_vocabulary_name($conf);
  $form['settings']['vocabulary'] = array(
    '#title' => t('Vocabulary'),
    '#type' => 'select',
    '#options' => $options,
    '#description' => t('Select the vocabulary for this form. If there exists a parent term in that vocabulary, this access check will succeed.'),
    '#id' => 'ctools-select-vocabulary',
    '#default_value' => !empty($conf['vocabulary']) ? $conf['vocabulary'] : array(),
    '#required' => TRUE,
  );
  $form['settings']['depth'] = array(
    '#title' => t('Depth'),
    '#type' => 'textfield',
    '#description' => t('Set the required depth of the term. If the term exists at the correct depth, this access check will succeed.'),
    '#default_value' => $conf['depth'],
    '#required' => TRUE,
  );
  return $form;
}