You are here

public function SearchApiAlterAddCombined::formButtonSubmit in Search API Combined Fields 7

Submit helper callback for buttons in the callback's configuration form.

File

./callback_add_combined.inc, line 233

Class

SearchApiAlterAddCombined
Search API data alteration callback that adds an URL field for all items.

Code

public function formButtonSubmit(array $form, array &$form_state) {
  $button_name = $form_state['triggering_element']['#name'];
  if ($button_name == 'op') {
    for ($i = 1; isset($this->options['fields']['search_api_combined_' . $i]); ++$i) {
    }
    $this->options['fields']['search_api_combined_' . $i] = array(
      'name' => '',
      'type' => 'fulltext',
      'fields' => array(),
    );
  }
  else {
    $field = substr($button_name, 31);
    unset($this->options['fields'][$field]);
  }
  $form_state['rebuild'] = TRUE;
  $this->changes = TRUE;
}