function ctools_term_parent_ctools_access_settings

Settings form for the 'by parent term' access plugin.

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

File

plugins/access/term_parent.inc, line 27

Code

function ctools_term_parent_ctools_access_settings($form, &$form_state, $conf) {
    // If no configuration was saved before, set some defaults.
    if (empty($conf)) {
        $conf = array(
            'vid' => 0,
        );
    }
    if (!isset($conf['vid'])) {
        $conf['vid'] = 0;
    }
    $form['settings']['vid'] = array(
        '#title' => t('Vocabulary'),
        '#type' => 'select',
        '#options' => array(),
        '#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-vid',
        '#default_value' => $conf['vid'],
        '#required' => TRUE,
    );
    $options = array();
    // Loop over each of the configured vocabularies.
    foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
        $options[$vid] = $vocabulary->name;
    }
    $form['settings']['vid']['#options'] = $options;
    return $form;
}