public function SearchApiAlterAddAggregation::formButtonSubmit in Search API 7
Submit helper callback for buttons in the callback's configuration form.
File
- includes/
callback_add_aggregation.inc, line 355 - Contains SearchApiAlterAddAggregation.
Class
- SearchApiAlterAddAggregation
- 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') {
// Increment $i until the corresponding field is not set, then create the
// field with that number as suffix.
for ($i = 1; isset($this->options['fields']['search_api_aggregation_' . $i]); ++$i) {
}
$this->options['fields']['search_api_aggregation_' . $i] = array(
'name' => '',
'type' => 'fulltext',
'fields' => array(),
);
}
else {
$field = substr($button_name, 34);
unset($this->options['fields'][$field]);
}
$form_state['rebuild'] = TRUE;
$this->changes = TRUE;
}