You are here

function search_by_page_form in Search by Page 7

Same name and namespace in other branches
  1. 8 search_by_page.module \search_by_page_form()
  2. 6 search_by_page.module \search_by_page_form()

Returns a Forms API array for the search by pages form.

See also

search_by_page_form_submit()

2 string references to 'search_by_page_form'
search_by_page_block_view in ./search_by_page.module
Implements hook_block_view().
_search_by_page_view in ./search_by_page.module
Returns a ready-to-render search form and/or results page.

File

./search_by_page.module, line 1159
Main module file for Drupal module Search by Page.

Code

function search_by_page_form($form, &$form_state, $environment, $keys = '', $is_block = TRUE) {
  $form['#action'] = url(search_by_page_setting_get('page_path', $environment, 'search_pages'));
  $form['#attributes'] = array(
    'class' => 'search-by-page-form',
  );
  $form['#method'] = 'post';
  $fieldlabel = search_by_page_setting_get('field_label', $environment, t('Search for'));
  $buttonlabel = search_by_page_setting_get('button_label', $environment, t('Search'));
  if (module_exists('i18n_string')) {
    $fieldlabel = i18n_string_translate('search_by_page:search_form:field_label' . $environment, $fieldlabel);
    $buttonlabel = i18n_string_translate('search_by_page:search_form:button_label' . $environment, $buttonlabel);
  }
  $form['keys'] = array(
    '#type' => 'textfield',
    '#title' => $fieldlabel,
    '#default_value' => $keys,
    '#size' => 30,
    '#maxlength' => 255,
  );
  $form['environment'] = array(
    '#type' => 'value',
    '#value' => $environment,
  );
  $form['is_block'] = array(
    '#type' => 'value',
    '#value' => $is_block,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => $buttonlabel,
  );
  return $form;
}