You are here

function apachesolr_nan_add_item in Apache Solr Not-A-Node 7

Handles adding an additional item to the admin form.

See also

apachesolr_nan_nan_settings_form().

1 string reference to 'apachesolr_nan_add_item'
apachesolr_nan_nan_settings_form in ./apachesolr_nan.admin.inc
Builds the administration form for Apache Solr NAN search.

File

./apachesolr_nan.admin.inc, line 121
Administrative functions and form builders for Apache Solr NAN Search.

Code

function apachesolr_nan_add_item($form, &$form_state) {

  // Add an element to the end of the array with the next available number.
  if (empty($form_state['items'])) {
    $form_state['items'][] = array();
  }
  else {
    $keys = array_keys($form_state['items']);
    $end = end($keys);
    $end++;
    $form_state['items'][$end] = array();
  }

  // Rebulid the form.
  $form_state['rebuild'] = TRUE;
  drupal_set_message(t('Your changes will not be saved until you press the submit button.'), 'warning');
}