You are here

function search_by_page_form in Search by Page 6

Same name and namespace in other branches
  1. 8 search_by_page.module \search_by_page_form()
  2. 7 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 in ./search_by_page.module
Implementation of hook_block().
_search_by_page_view in ./search_by_page.module
Returns rendered search form and/or results page.

File

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

Code

function search_by_page_form(&$form_state, $environment, $keys = '', $is_block = TRUE) {
  $form = array(
    '#action' => url(search_by_page_setting_get('page_path', $environment, 'search_pages')),
    '#attributes' => array(
      'class' => 'search-by-page-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('i18nstrings')) {
    $fieldlabel = i18nstrings('search_by_page:search_form:field_label' . $environment, $fieldlabel);
    $buttonlabel = i18nstrings('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;
}