You are here

function search_api_server_status_form in Search API 7

Form constructor for server operations.

Parameters

SearchApiServer $server: The server for which the form is displayed.

See also

search_api_server_status_form_submit()

1 string reference to 'search_api_server_status_form'
search_api_admin_server_view in ./search_api.admin.inc
Page callback: Displays information about a server.

File

./search_api.admin.inc, line 540
Administration page callbacks for the Search API module.

Code

function search_api_server_status_form(array $form, array &$form_state, SearchApiServer $server) {
  $form_state['server'] = $server;
  $form['clear'] = array(
    '#type' => 'submit',
    '#value' => t('Delete all indexed data on this server'),
    '#submit' => array(
      'search_api_server_status_form_clear_submit',
    ),
  );
  $count = $server->enabled ? search_api_server_tasks_count($server) : 0;
  if ($count) {
    $message = format_plural($count, '@count pending task must be executed before indexing.', '@count pending tasks must be executed before indexing.');
    drupal_set_message($message, 'warning', FALSE);
    $form['execute_pending_tasks'] = array(
      '#type' => 'submit',
      '#value' => t('Execute all pending tasks on this server'),
      '#submit' => array(
        'search_api_server_status_form_execute_pending_tasks_submit',
      ),
    );
  }
  return $form;
}