You are here

public function SolrConfigSetController::getSchemaExtraFieldsXml in Search API Solr 8.3

Same name and namespace in other branches
  1. 4.x src/Controller/SolrConfigSetController.php \Drupal\search_api_solr\Controller\SolrConfigSetController::getSchemaExtraFieldsXml()

Provides an XML snippet containing all extra Solr fields.

Parameters

\Drupal\search_api\ServerInterface|null $search_api_server: The Search API server entity.

Return value

string XML snippet containing all extra Solr fields.

Throws

\Drupal\search_api\SearchApiException

2 calls to SolrConfigSetController::getSchemaExtraFieldsXml()
SolrConfigSetController::getConfigFiles in src/Controller/SolrConfigSetController.php
Returns the configuration files names and content.
SolrConfigSetController::streamSchemaExtraFieldsXml in src/Controller/SolrConfigSetController.php
Streams schema_extra_fields.xml.

File

src/Controller/SolrConfigSetController.php, line 73

Class

SolrConfigSetController
Provides different listings of SolrFieldType.

Namespace

Drupal\search_api_solr\Controller

Code

public function getSchemaExtraFieldsXml(?ServerInterface $search_api_server = NULL) : string {
  $solr_major_version = NULL;
  if ($search_api_server) {

    /** @var \Drupal\search_api_solr\SolrBackendInterface $backend */
    $backend = $search_api_server
      ->getBackend();
    $solr_major_version = $backend
      ->getSolrConnector()
      ->getSolrMajorVersion();
  }

  /** @var \Drupal\search_api_solr\Controller\SolrFieldTypeListBuilder $list_builder */
  $list_builder = $this
    ->getListBuilder('solr_field_type', $search_api_server);
  return $list_builder
    ->getSchemaExtraFieldsXml($solr_major_version);
}