You are here

function om_search in OM Tools 6

Same name and namespace in other branches
  1. 8.2 tools/search/search.inc \om_search()
  2. 8 tools/search/search.inc \om_search()
  3. 6.2 tools/search/search.inc \om_search()
  4. 7.2 tools/search/search.inc \om_search()
  5. 7 tools/search/search.inc \om_search()

OM Tools Search Form Settings

File

tools/search/search.inc, line 11
Search form alters

Code

function om_search(&$form) {
  drupal_add_js(drupal_get_path('module', 'om_tools') . '/tools/search/js/search.js', 'module');
  $form['search_forms'] = array(
    '#type' => 'fieldset',
    '#title' => t('Search Forms'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );

  // Reset Search Theme Form
  if (variable_get('om_tools_search_theme_reset', 0)) {
    variable_set('om_tools_search_theme_label', 1);
    variable_set('om_tools_search_theme_label_text', 'Search this site');
    variable_set('om_tools_search_theme_size', 15);
    variable_set('om_tools_search_theme_hover', 'Enter the terms you wish to search for.');
    variable_set('om_tools_search_theme_button', 'Go');
    variable_set('om_tools_search_theme_reset', 0);
  }

  // Search Theme Form
  $form['search_forms']['search_theme_alter'] = array(
    '#type' => 'fieldset',
    '#title' => t('Search Theme Form'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t(''),
  );
  $form['search_forms']['search_theme_alter']['search_theme_alter_switch'] = array(
    '#type' => 'checkbox',
    '#title' => t('Change Search Theme Form'),
    '#default_value' => variable_get('om_tools_search_theme_alter_switch', 0),
    '#description' => t(''),
  );
  $form['search_forms']['search_theme_alter']['search_theme_settings'] = array(
    '#type' => 'fieldset',
    '#attributes' => array(
      'id' => 'om-group-search-theme-settings',
    ),
    '#title' => t('Search Settings'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#description' => t(''),
  );
  $form['search_forms']['search_theme_alter']['search_theme_settings']['search_theme_label'] = array(
    '#type' => 'checkbox',
    '#title' => t('Put label inside the search box.'),
    '#default_value' => variable_get('om_tools_search_theme_label', 1),
    '#description' => t(''),
  );
  $form['search_forms']['search_theme_alter']['search_theme_settings']['search_theme_label_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Label Text'),
    '#default_value' => variable_get('om_tools_search_theme_label_text', 'Search this site'),
    '#description' => t(''),
  );
  $form['search_forms']['search_theme_alter']['search_theme_settings']['search_theme_size'] = array(
    '#type' => 'textfield',
    '#title' => t('Search box size'),
    '#default_value' => variable_get('om_tools_search_theme_size', 15),
    '#description' => t(''),
  );
  $form['search_forms']['search_theme_alter']['search_theme_settings']['search_theme_hover'] = array(
    '#type' => 'textfield',
    '#title' => t('Rollover Text'),
    '#default_value' => variable_get('om_tools_search_theme_hover', 'Enter the terms you wish to search for.'),
    '#description' => t(''),
  );
  $form['search_forms']['search_theme_alter']['search_theme_settings']['search_theme_button'] = array(
    '#type' => 'textfield',
    '#title' => t('Button Text'),
    '#default_value' => variable_get('om_tools_search_theme_button', 'Go'),
    '#description' => t(''),
  );
  $form['search_forms']['search_theme_alter']['search_theme_reset'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reset to default values.'),
    '#default_value' => variable_get('om_tools_search_theme_reset', 0),
    '#description' => t(''),
  );

  // Reset Search Block
  if (variable_get('om_tools_search_block_reset', 0)) {
    variable_set('om_tools_search_block_label', 1);
    variable_set('om_tools_search_block_label_text', 'Search this site');
    variable_set('om_tools_search_block_size', 15);
    variable_set('om_tools_search_block_hover', 'Enter the terms you wish to search for.');
    variable_set('om_tools_search_block_button', 'Go');
    variable_set('om_tools_search_block_reset', 0);
  }

  // Search Block Form
  $form['search_forms']['search_block_alter'] = array(
    '#type' => 'fieldset',
    '#title' => t('Search Block Form'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t(''),
  );
  $form['search_forms']['search_block_alter']['search_block_alter_switch'] = array(
    '#type' => 'checkbox',
    '#title' => t('Change Search Block Form'),
    '#default_value' => variable_get('om_tools_search_block_alter_switch', 0),
    '#description' => t(''),
  );
  $form['search_forms']['search_block_alter']['search_block_settings'] = array(
    '#type' => 'fieldset',
    '#attributes' => array(
      'id' => 'om-group-search-block-settings',
    ),
    '#title' => t('Search Settings'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#description' => t(''),
  );
  $form['search_forms']['search_block_alter']['search_block_settings']['search_block_label'] = array(
    '#type' => 'checkbox',
    '#title' => t('Put label inside the search box.'),
    '#default_value' => variable_get('om_tools_search_block_label', 1),
    '#description' => t(''),
  );
  $form['search_forms']['search_block_alter']['search_block_settings']['search_block_label_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Label Text'),
    '#default_value' => variable_get('om_tools_search_block_label_text', 'Search this site'),
    '#description' => t(''),
  );
  $form['search_forms']['search_block_alter']['search_block_settings']['search_block_size'] = array(
    '#type' => 'textfield',
    '#title' => t('Search box size'),
    '#default_value' => variable_get('om_tools_search_block_size', 15),
    '#description' => t(''),
  );
  $form['search_forms']['search_block_alter']['search_block_settings']['search_block_hover'] = array(
    '#type' => 'textfield',
    '#title' => t('Rollover Text'),
    '#default_value' => variable_get('om_tools_search_block_hover', 'Enter the terms you wish to search for.'),
    '#description' => t(''),
  );
  $form['search_forms']['search_block_alter']['search_block_settings']['search_block_button'] = array(
    '#type' => 'textfield',
    '#title' => t('Button Text'),
    '#default_value' => variable_get('om_tools_search_block_button', 'Go'),
    '#description' => t(''),
  );
  $form['search_forms']['search_block_alter']['search_block_reset'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reset to default values.'),
    '#default_value' => variable_get('om_tools_search_block_reset', 0),
    '#description' => t(''),
  );

  // Reset Search Page
  if (variable_get('om_tools_search_reset', 0)) {
    variable_set('om_tools_search_title', 'Search');
    variable_set('om_tools_search_label', 1);
    variable_set('om_tools_search_label_text', 'Enter your keywords');
    variable_set('om_tools_search_size', 30);
    variable_set('om_tools_search_hover', 'Enter the terms you wish to search for.');
    variable_set('om_tools_search_button', 'Go');
    variable_set('om_tools_search_reset', 0);
  }

  // Search Page
  $form['search_forms']['search_alter'] = array(
    '#type' => 'fieldset',
    '#title' => t('Search Page Form'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t(''),
  );
  $form['search_forms']['search_alter']['search_alter_switch'] = array(
    '#type' => 'checkbox',
    '#title' => t('Change Search Page Form'),
    '#default_value' => variable_get('om_tools_search_alter_switch', 0),
    '#description' => t(''),
  );
  $form['search_forms']['search_alter']['search_settings'] = array(
    '#type' => 'fieldset',
    '#attributes' => array(
      'id' => 'om-group-search-settings',
    ),
    '#title' => t('Search Settings'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#description' => t(''),
  );
  $form['search_forms']['search_alter']['search_settings']['search_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Search page title'),
    '#default_value' => variable_get('om_tools_search_title', 'Search'),
    '#description' => t(''),
  );
  $form['search_forms']['search_alter']['search_settings']['search_label'] = array(
    '#type' => 'checkbox',
    '#title' => t('Put label inside the search box.'),
    '#default_value' => variable_get('om_tools_search_label', 1),
    '#description' => t(''),
  );
  $form['search_forms']['search_alter']['search_settings']['search_label_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Label Text'),
    '#default_value' => variable_get('om_tools_search_label_text', 'Enter your keywords'),
    '#description' => t(''),
  );
  $form['search_forms']['search_alter']['search_settings']['search_size'] = array(
    '#type' => 'textfield',
    '#title' => t('Search box size'),
    '#default_value' => variable_get('om_tools_search_size', 30),
    '#description' => t(''),
  );
  $form['search_forms']['search_alter']['search_settings']['search_hover'] = array(
    '#type' => 'textfield',
    '#title' => t('Rollover Text'),
    '#default_value' => variable_get('om_tools_search_hover', 'Enter the terms you wish to search for.'),
    '#description' => t(''),
  );
  $form['search_forms']['search_alter']['search_settings']['search_button'] = array(
    '#type' => 'textfield',
    '#title' => t('Button Text'),
    '#default_value' => variable_get('om_tools_search_button', 'Go'),
    '#description' => t(''),
  );
  $form['search_forms']['search_alter']['search_reset'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reset to default values.'),
    '#default_value' => variable_get('om_tools_search_reset', 0),
    '#description' => t(''),
  );
  return $form;
}