You are here

function apachesolr_search_ajax_search_page_default in Apache Solr Search 7

Same name and namespace in other branches
  1. 8 apachesolr_search.admin.inc \apachesolr_search_ajax_search_page_default()
  2. 6.3 apachesolr_search.admin.inc \apachesolr_search_ajax_search_page_default()

Callback element needs only select the portion of the form to be updated. Since #ajax['callback'] return can be HTML or a renderable array (or an array of commands), we can just return a piece of the form.

1 string reference to 'apachesolr_search_ajax_search_page_default'
apachesolr_search_page_settings_form in ./apachesolr_search.admin.inc
Menu callback/form-builder for the form to create or edit a search page.

File

./apachesolr_search.admin.inc, line 434
Administrative settings for searching.

Code

function apachesolr_search_ajax_search_page_default($form, $form_state, $search_page = NULL) {
  $search_page = $form_state['values']['search_page'];
  $search_types = apachesolr_search_load_all_search_types();

  // Helping with sensible defaults for the search path
  $default_search_path = '';
  if (!empty($form_state['values']['search_type']) && $form_state['values']['search_type'] != 'custom') {
    $default_search_path = $search_types[$form_state['values']['search_type']]['default menu'];
    $form['info']['search_path']['#value'] = $default_search_path;
  }

  // Helping with sensible defaults for the search title
  $default_search_title = '';
  if (empty($form_state['values']['page_title']) && $form_state['values']['search_type'] != 'custom') {
    $default_search_title_callback = $search_types[$form_state['values']['search_type']]['title callback'];
    $default_search_title = $default_search_title_callback();
    $form['info']['page_title']['#value'] = $default_search_title;
  }
  return $form['info'];
}