You are here

public function SearchApiAlterNodeAccess::configurationFormSubmit in Search API 7

Overrides SearchApiAbstractAlterCallback::configurationFormSubmit().

If the data alteration is being enabled, set "Published" and "Author" to "indexed", because both are needed for the node access filter.

Overrides SearchApiAbstractAlterCallback::configurationFormSubmit

1 call to SearchApiAlterNodeAccess::configurationFormSubmit()
SearchApiAlterCommentAccess::configurationFormSubmit in includes/callback_comment_access.inc
Overrides SearchApiAlterNodeAccess::configurationFormSubmit().
1 method overrides SearchApiAlterNodeAccess::configurationFormSubmit()
SearchApiAlterCommentAccess::configurationFormSubmit in includes/callback_comment_access.inc
Overrides SearchApiAlterNodeAccess::configurationFormSubmit().

File

includes/callback_node_access.inc, line 85
Contains the SearchApiAlterNodeAccess class.

Class

SearchApiAlterNodeAccess
Adds node access information to node indexes.

Code

public function configurationFormSubmit(array $form, array &$values, array &$form_state) {
  $old_status = !empty($form_state['index']->options['data_alter_callbacks']['search_api_alter_node_access']['status']);
  $new_status = !empty($form_state['values']['callbacks']['search_api_alter_node_access']['status']);
  if (!$old_status && $new_status) {
    $form_state['index']->options['fields']['status']['type'] = 'boolean';
    $form_state['index']->options['fields']['author']['type'] = 'integer';
    $form_state['index']->options['fields']['author']['entity_type'] = 'user';
  }
  return parent::configurationFormSubmit($form, $values, $form_state);
}