/** * Enables a search server without a confirmation form. * * @param \Drupal\search_api\ServerInterface $search_api_server * The server to be enabled. * * @return \Symfony\Component\HttpFoundation\Response * The response to send to the browser. */ public function serverBypassEnable(ServerInterface $search_api_server) { $search_api_server->setStatus(TRUE)->save(); // Notify the user about the status change. drupal_set_message($this->t('The search server %name has been enabled.', array('%name' => $search_api_server->label()))); // Redirect to the server's "View" page. $url = $search_api_server->urlInfo('canonical'); return $this->redirect($url->getRouteName(), $url->getRouteParameters()); }