You are here

function custom_search_blocks_form in Custom Search 7

Same name and namespace in other branches
  1. 6 modules/custom_search_blocks/custom_search_blocks.module \custom_search_blocks_form()

Form builder; Output a search form for the additional search blocks.

3 string references to 'custom_search_blocks_form'
custom_search_blocks_forms in modules/custom_search_blocks/custom_search_blocks.module
Implements hook_forms().
custom_search_form_alter in ./custom_search.module
Implements hook_form_alter().
custom_search_taxonomy_form_alter in modules/custom_search_taxonomy/custom_search_taxonomy.module
Implements hook_form_alter().

File

modules/custom_search_blocks/custom_search_blocks.module, line 129
Bring additional search blocks

Code

function custom_search_blocks_form($form, &$form_state, $delta) {
  $form['custom_search_blocks_form_' . $delta] = array(
    '#type' => 'textfield',
    '#size' => 15,
    '#default_value' => '',
    '#attributes' => array(
      'title' => t('Enter the terms you wish to search for.'),
    ),
  );
  $form['delta'] = array(
    '#type' => 'hidden',
    '#value' => $delta,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Search'),
  );
  $form['#submit'] = array(
    'custom_search_submit',
  );
  if (function_exists('apachesolr_autocomplete_variable_get_widget')) {

    // Support for apachesolr_autocomplete module.
    if (apachesolr_autocomplete_variable_get_widget() == 'custom') {
      $form['custom_search_blocks_form_' . $delta]['#attributes']['class'] = array(
        'apachesolr-autocomplete',
        'unprocessed',
      );
    }
    else {
      $form['custom_search_blocks_form_' . $delta]['#autocomplete_path'] = 'apachesolr_autocomplete';
    }
  }
  return $form;
}