You are here

function _custom_search_taxonomy_admin_form in Custom Search 7

Default admin form.

2 calls to _custom_search_taxonomy_admin_form()
custom_search_taxonomy_admin in modules/custom_search_taxonomy/custom_search_taxonomy.admin.inc
custom_search_taxonomy_form_alter in modules/custom_search_taxonomy/custom_search_taxonomy.module
Implements hook_form_alter().

File

modules/custom_search_taxonomy/custom_search_taxonomy.module, line 173
Bring customizations to the default search box

Code

function _custom_search_taxonomy_admin_form($vocabularies, $delta = '') {
  if ($delta != '') {
    $delta = 'blocks_' . $delta . '_';
  }
  $form = array();
  foreach ($vocabularies as $voc) {
    $form[$voc->name] = array(
      '#type' => 'fieldset',
      '#title' => check_plain($voc->name),
      '#collapsible' => TRUE,
      '#collapsed' => variable_get('custom_search_' . $delta . 'voc' . $voc->vid . '_selector', 'disabled') == 'disabled' ? TRUE : FALSE,
    );
    $form[$voc->name]['custom_search_' . $delta . 'voc' . $voc->vid . '_selector'] = array(
      '#type' => 'select',
      '#title' => t('Selector type'),
      '#options' => array(
        'disabled' => t('Disabled'),
        'select' => t('Drop-down list'),
        'selectmultiple' => t('Drop-down list with multiple choices'),
        'radios' => t('Radio buttons'),
        'checkboxes' => t('Checkboxes'),
      ),
      '#description' => t('Choose which selector type to use.'),
      '#default_value' => variable_get('custom_search_' . $delta . 'voc' . $voc->vid . '_selector', 'disabled'),
    );
    if (module_exists('hs_taxonomy')) {
      $form[$voc->name]['custom_search_' . $delta . 'voc' . $voc->vid . '_selector']['#options']['hierarchical_select'] = t('Hierarchical selector');
    }
    $form[$voc->name]['custom_search_' . $delta . 'voc' . $voc->vid . '_selector_depth'] = array(
      '#type' => 'textfield',
      '#title' => t('Depth'),
      '#size' => 2,
      '#default_value' => variable_get('custom_search_' . $delta . 'voc' . $voc->vid . '_selector_depth', 0),
      '#description' => t('Define the maximum depth of terms being displayed. The default value is "0" which disables the limit.'),
    );
    $form[$voc->name]['custom_search_' . $delta . 'voc' . $voc->vid . '_selector_label_visibility'] = array(
      '#type' => 'checkbox',
      '#title' => t('Display label'),
      '#default_value' => variable_get('custom_search_' . $delta . 'voc' . $voc->vid . '_selector_label_visibility', TRUE),
    );
    $form[$voc->name]['custom_search_' . $delta . 'voc' . $voc->vid . '_selector_label'] = array(
      '#type' => 'textfield',
      '#title' => t('Label text'),
      '#default_value' => variable_get('custom_search_' . $delta . 'voc' . $voc->vid . '_selector_label', $voc->name),
      '#description' => t('Enter the label text for the selector. The default value is "@default".', array(
        '@default' => $voc->name,
      )),
      '#states' => array(
        'visible' => array(
          ':input[name="custom_search_' . $delta . 'voc' . $voc->vid . '_selector_label_visibility"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $form[$voc->name]['custom_search_' . $delta . 'voc' . $voc->vid . '_selector_all'] = array(
      '#type' => 'textfield',
      '#title' => t('-Any- text'),
      '#default_value' => variable_get('custom_search_' . $delta . 'voc' . $voc->vid . '_selector_all', CUSTOM_SEARCH_ALL_TEXT_DEFAULT),
      '#required' => TRUE,
      '#description' => t('Enter the text for "any term" choice. The default value is "!default".', array(
        '!default' => CUSTOM_SEARCH_ALL_TEXT_DEFAULT,
      )),
    );
  }
  return $form;
}