You are here

function _custom_search_default_admin_form in Custom Search 6

Same name and namespace in other branches
  1. 7 includes/forms.inc \_custom_search_default_admin_form()

Image button form.

2 calls to _custom_search_default_admin_form()
custom_search_admin in ./custom_search.admin.inc
@file Admin settings for custom search
custom_search_blocks_block in modules/custom_search_blocks/custom_search_blocks.module
Implementation of hook_block() to provide additional blocks.

File

includes/forms.inc, line 6

Code

function _custom_search_default_admin_form($delta = '') {
  if ($delta != '') {
    $delta = 'blocks_' . $delta . '_';
  }

  // Labels & default text.
  $form['search_box'] = array(
    '#type' => 'fieldset',
    '#title' => t('Search box'),
  );
  $form['search_box']['custom_search_' . $delta . 'label_visibility'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display label'),
    '#default_value' => variable_get('custom_search_' . $delta . 'label_visibility', TRUE),
  );
  $form['search_box']['custom_search_' . $delta . 'label'] = array(
    '#type' => 'textfield',
    '#title' => t('Search box label'),
    '#default_value' => variable_get('custom_search_' . $delta . 'label', CUSTOM_SEARCH_LABEL_DEFAULT),
    '#description' => t('Enter the label text for the search box. The default value is "!default".', array(
      '!default' => CUSTOM_SEARCH_LABEL_DEFAULT,
    )),
  );
  $form['search_box']['custom_search_' . $delta . 'text'] = array(
    '#type' => 'textfield',
    '#title' => t('Search box default text'),
    '#default_value' => variable_get('custom_search_' . $delta . 'text', ''),
    '#description' => t('This will change the default text inside the search form. Leave blank for no text. This field is blank by default.'),
  );
  $form['search_box']['custom_search_' . $delta . 'size'] = array(
    '#type' => 'textfield',
    '#title' => t('Search box size'),
    '#size' => 3,
    '#default_value' => variable_get('custom_search_' . $delta . 'size', CUSTOM_SEARCH_SIZE_DEFAULT),
    '#description' => t('The default value is "!default".', array(
      '!default' => CUSTOM_SEARCH_SIZE_DEFAULT,
    )),
  );
  $form['search_box']['custom_search_' . $delta . 'max_length'] = array(
    '#type' => 'textfield',
    '#title' => t('Search box maximum length'),
    '#size' => 3,
    '#default_value' => variable_get('custom_search_' . $delta . 'max_length', CUSTOM_SEARCH_MAX_LENGTH_DEFAULT),
    '#description' => t('The default value is "!default".', array(
      '!default' => CUSTOM_SEARCH_MAX_LENGTH_DEFAULT,
    )),
    '#required' => TRUE,
  );

  // Submit button.
  $form['submit_button'] = array(
    '#type' => 'fieldset',
    '#title' => t('Submit button'),
  );
  $form['submit_button']['custom_search_' . $delta . 'submit_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Submit button text'),
    '#default_value' => variable_get('custom_search_' . $delta . 'submit_text', CUSTOM_SEARCH_SUBMIT_TEXT_DEFAULT),
    '#description' => t('Enter the text for the submit button. Leave blank to hide it. The default value is "!default".', array(
      '!default' => CUSTOM_SEARCH_SUBMIT_TEXT_DEFAULT,
    )),
  );
  $form['submit_button']['custom_search_' . $delta . 'image_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Submit image path'),
    '#description' => t('The path to the file you would like to use as submit button instead of the default text button.'),
    '#default_value' => variable_get('custom_search_' . $delta . 'image_path', ''),
  );
  $form['submit_button']['custom_search_image'] = array(
    '#type' => 'file',
    '#title' => t('Submit image'),
    '#description' => t('If you don\'t have direct file access to the server, use this field to upload your image.'),
  );

  // Criteria.
  $form['criteria'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced search criteria'),
  );
  $form['criteria']['or'] = array(
    '#type' => 'fieldset',
    '#title' => t('Or'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['criteria']['or']['custom_search_' . $delta . 'criteria_or_display'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display'),
    '#default_value' => variable_get('custom_search_' . $delta . 'criteria_or_display', FALSE),
  );
  $form['criteria']['or']['custom_search_' . $delta . 'criteria_or_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Label'),
    '#default_value' => variable_get('custom_search_' . $delta . 'criteria_or_label', CUSTOM_SEARCH_CRITERIA_OR_LABEL_DEFAULT),
    '#description' => t('Enter the label text for this field. The default value is "!default".', array(
      '!default' => CUSTOM_SEARCH_CRITERIA_OR_LABEL_DEFAULT,
    )),
  );
  $form['criteria']['phrase'] = array(
    '#type' => 'fieldset',
    '#title' => t('Phrase'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['criteria']['phrase']['custom_search_' . $delta . 'criteria_phrase_display'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display'),
    '#default_value' => variable_get('custom_search_' . $delta . 'criteria_phrase_display', FALSE),
  );
  $form['criteria']['phrase']['custom_search_' . $delta . 'criteria_phrase_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Label'),
    '#default_value' => variable_get('custom_search_' . $delta . 'criteria_phrase_label', CUSTOM_SEARCH_CRITERIA_PHRASE_LABEL_DEFAULT),
    '#description' => t('Enter the label text for this field. The default value is "!default".', array(
      '!default' => CUSTOM_SEARCH_CRITERIA_PHRASE_LABEL_DEFAULT,
    )),
  );
  $form['criteria']['negative'] = array(
    '#type' => 'fieldset',
    '#title' => t('Negative'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['criteria']['negative']['custom_search_' . $delta . 'criteria_negative_display'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display'),
    '#default_value' => variable_get('custom_search_' . $delta . 'criteria_negative_display', FALSE),
  );
  $form['criteria']['negative']['custom_search_' . $delta . 'criteria_negative_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Label'),
    '#default_value' => variable_get('custom_search_' . $delta . 'criteria_negative_label', CUSTOM_SEARCH_CRITERIA_NEGATIVE_LABEL_DEFAULT),
    '#description' => t('Enter the label text for this field. The default value is "!default".', array(
      '!default' => CUSTOM_SEARCH_CRITERIA_NEGATIVE_LABEL_DEFAULT,
    )),
  );
  return $form;
}