You are here

function search_api_solr_entity_operation in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 search_api_solr.module \search_api_solr_entity_operation()
  2. 4.x search_api_solr.module \search_api_solr_entity_operation()

Implements hook_entity_operation().

Adds an operation to Solr servers to directly generate and download a config.

Parameters

\Drupal\Core\Entity\EntityInterface $server:

Return value

array

Throws

\Drupal\search_api\SearchApiException

File

./search_api_solr.module, line 461

Code

function search_api_solr_entity_operation(\Drupal\Core\Entity\EntityInterface $server) {
  $operations = [];
  if ($server instanceof Server && $server
    ->getBackend() instanceof SolrBackendInterface && !$server
    ->getBackend() instanceof SearchApiSolrAnySchemaBackend) {
    $operations['get_config_zip'] = [
      'title' => t('Get config.zip'),
      'url' => \Drupal\Core\Url::fromRoute('entity.solr_field_type.config_zip_collection', [
        'search_api_server' => $server
          ->id(),
      ]),
      'weight' => 50,
    ];
  }
  return $operations;
}