You are here

function apachesolr_nan_add_form_item in Apache Solr Not-A-Node 7.2

function apachesolr_nan_add_form_item().

Handles adding an additional item to the admin form.

See also

apachesolr_nan_nan_settings_form().

1 string reference to 'apachesolr_nan_add_form_item'
apachesolr_nan_nan_settings_form in ./apachesolr_nan.admin.inc
function apachesolr_nan_nan_settings_form().

File

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

Code

function apachesolr_nan_add_form_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');
}