You are here

function om_search_block in OM Tools 8.2

Same name and namespace in other branches
  1. 6.2 tools/search/search.inc \om_search_block()
  2. 7.2 tools/search/search.inc \om_search_block()

Search Block Form

1 call to om_search_block()
om_search_tools in tools/search/search.inc
Search Tools Form

File

tools/search/search.inc, line 176
Search Tools

Code

function om_search_block($search_defaults = array()) {

  // Search Block
  $out = array();

  // Reset Search Block
  if (!isset($search_defaults['search_block_label']) || $search_defaults['search_block_reset'] == 1) {
    $search_defaults['search_block_label'] = 1;
    $search_defaults['search_block_label_text'] = 'Search this site';
    $search_defaults['search_block_size'] = 15;
    $search_defaults['search_block_hover'] = 'Enter the terms you wish to search for.';
    $search_defaults['search_block_button'] = 'Go';
    $search_defaults['search_block_reset'] = 0;
  }
  $out['search_block_switch'] = array(
    '#type' => 'checkbox',
    '#title' => t('Change Search Block Form'),
    '#default_value' => isset($search_defaults['search_block_switch']) ? $search_defaults['search_block_switch'] : 0,
  );
  $out['search_block_settings'] = array(
    '#type' => 'fieldset',
    '#attributes' => array(
      'id' => 'om-group-search-block-settings',
    ),
    '#title' => t('Search Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $out['search_block_settings']['search_block_label'] = array(
    '#type' => 'checkbox',
    '#title' => t('Put label inside the search box.'),
    '#default_value' => isset($search_defaults['search_block_label']) ? $search_defaults['search_block_label'] : 1,
  );
  $out['search_block_settings']['search_block_label_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Label Text'),
    '#default_value' => isset($search_defaults['search_block_label_text']) ? $search_defaults['search_block_label_text'] : '',
  );
  $out['search_block_settings']['search_block_size'] = array(
    '#type' => 'textfield',
    '#title' => t('Search box size'),
    '#default_value' => isset($search_defaults['search_block_size']) ? $search_defaults['search_block_size'] : 15,
    '#description' => t(''),
  );
  $out['search_block_settings']['search_block_hover'] = array(
    '#type' => 'textfield',
    '#title' => t('Rollover Text'),
    '#default_value' => isset($search_defaults['search_block_hover']) ? $search_defaults['search_block_hover'] : '',
  );
  $out['search_block_settings']['search_block_button'] = array(
    '#type' => 'textfield',
    '#title' => t('Button Text'),
    '#default_value' => isset($search_defaults['search_block_button']) ? $search_defaults['search_block_button'] : 'Go',
  );
  $out['search_block_reset'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reset to default values.'),
    '#default_value' => isset($search_defaults['search_block_reset']) ? $search_defaults['search_block_reset'] : 0,
  );
  return $out;
}