You are here

function custom_search_results_admin in Custom Search 7

Same name and namespace in other branches
  1. 6 custom_search.admin.inc \custom_search_results_admin()

Results page settings.

2 string references to 'custom_search_results_admin'
custom_search_i18n_form_alter in modules/custom_search_i18n/custom_search_i18n.module
Implements hook_form_alter().
custom_search_menu in ./custom_search.module
Implements hook_menu().

File

./custom_search.admin.inc, line 55
Admin settings for custom search

Code

function custom_search_results_admin() {
  $form['custom_search_target'] = array(
    '#type' => 'select',
    '#title' => t('Results page opens in'),
    '#options' => array(
      '_self' => t('the same window'),
      '_blank' => t('a new window'),
    ),
    '#default_value' => variable_get('custom_search_target', '_self'),
  );
  $form['search_form'] = array(
    '#type' => 'fieldset',
    '#title' => t('Search form'),
  );
  $form['search_form']['custom_search_results_search'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display basic search'),
    '#default_value' => variable_get('custom_search_results_search', TRUE),
  );
  $form['search_form']['custom_search_results_advanced_search'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display advanced search'),
    '#default_value' => variable_get('custom_search_results_advanced_search', TRUE),
  );
  $form['search_form']['advanced'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced search'),
    '#states' => array(
      'visible' => array(
        ':input[name="custom_search_results_advanced_search"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['search_form']['advanced']['custom_search_results_advanced_search_collapsible'] = array(
    '#type' => 'checkbox',
    '#title' => t('Collapsible'),
    '#default_value' => variable_get('custom_search_results_advanced_search_collapsible', TRUE),
  );
  $form['search_form']['advanced']['custom_search_results_advanced_search_collapsed'] = array(
    '#type' => 'checkbox',
    '#title' => t('Collapsed'),
    '#default_value' => variable_get('custom_search_results_advanced_search_collapsed', TRUE),
  );
  $form['search_form']['advanced']['criteria'] = array(
    '#type' => 'fieldset',
    '#title' => t('Criteria'),
    '#description' => t('Select the criteria to display on the advanced search form.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['search_form']['advanced']['criteria']['custom_search_advanced_or_display'] = array(
    '#type' => 'checkbox',
    '#title' => t('Or'),
    '#default_value' => variable_get('custom_search_advanced_or_display', TRUE),
  );
  $form['search_form']['advanced']['criteria']['custom_search_advanced_phrase_display'] = array(
    '#type' => 'checkbox',
    '#title' => t('Phrase'),
    '#default_value' => variable_get('custom_search_advanced_phrase_display', TRUE),
  );
  $form['search_form']['advanced']['criteria']['custom_search_advanced_negative_display'] = array(
    '#type' => 'checkbox',
    '#title' => t('Negative'),
    '#default_value' => variable_get('custom_search_advanced_negative_display', TRUE),
  );
  $form['search_form']['advanced']['types'] = array(
    '#type' => 'fieldset',
    '#title' => t('Content types'),
    '#description' => t('Select the content types to display on the advanced search form.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $options = node_type_get_names();
  foreach ($options as $type => $name) {
    $form['search_form']['advanced']['types']['custom_search_advanced_type_' . $type . '_display'] = array(
      '#type' => 'checkbox',
      '#title' => $name,
      '#default_value' => variable_get('custom_search_advanced_type_' . $type . '_display', TRUE),
    );
  }

  // Languages.
  $language_options = array();
  foreach (language_list('language') as $key => $entity) {
    if ($entity->enabled) {
      $language_options[$key] = $entity->name;
    }
  }

  // Add language neutral to the list.
  $language_options['und'] = t('Language neutral');
  $form['search_form']['advanced']['languages'] = array(
    '#type' => 'fieldset',
    '#title' => t('Languages'),
    '#description' => t('Select the languages to display on the advanced search form.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  foreach ($language_options as $key => $name) {
    $form['search_form']['advanced']['languages']['custom_search_advanced_language_' . $key . '_display'] = array(
      '#type' => 'checkbox',
      '#title' => $name,
      '#default_value' => variable_get('custom_search_advanced_language_' . $key . '_display', TRUE),
    );
  }
  $form['results'] = array(
    '#type' => 'fieldset',
    '#title' => t('Results'),
    '#description' => t('Select data to display below each result.'),
  );
  $form['results']['custom_search_results_info_type'] = array(
    '#type' => 'checkbox',
    '#title' => t('Content type'),
    '#default_value' => variable_get('custom_search_results_info_type', TRUE),
  );
  $form['results']['custom_search_results_info_user'] = array(
    '#type' => 'checkbox',
    '#title' => t('User'),
    '#default_value' => variable_get('custom_search_results_info_user', TRUE),
  );
  $form['results']['custom_search_results_info_date'] = array(
    '#type' => 'checkbox',
    '#title' => t('Date'),
    '#default_value' => variable_get('custom_search_results_info_date', TRUE),
  );
  if (module_exists('comment')) {
    $form['results']['custom_search_results_info_comment'] = array(
      '#type' => 'checkbox',
      '#title' => t('Comments'),
      '#default_value' => variable_get('custom_search_results_info_comment', TRUE),
    );
  }
  $form['filter'] = array(
    '#type' => 'fieldset',
    '#title' => t('Filter'),
    '#description' => t('Add links to filter the results by content type.'),
  );
  $form['filter']['custom_search_filter'] = array(
    '#type' => 'select',
    '#title' => t('Position'),
    '#options' => array(
      'disabled' => t('Disabled'),
      'above' => t('Above results'),
      'below' => t('Below results'),
    ),
    '#default_value' => variable_get('custom_search_filter', 'disabled'),
  );
  $form['filter']['custom_search_filter_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Label text'),
    '#default_value' => variable_get('custom_search_filter_label', CUSTOM_SEARCH_FILTER_LABEL_DEFAULT),
    '#description' => t('Enter the label text for the list. The default value is "!default".', array(
      '!default' => CUSTOM_SEARCH_FILTER_LABEL_DEFAULT,
    )),
    '#states' => array(
      'invisible' => array(
        ':input[name="custom_search_filter"]' => array(
          'value' => 'disabled',
        ),
      ),
    ),
  );
  return system_settings_form($form);
}