You are here

public function SolrRequestHandler::getAsXml in Search API Solr 8.3

Same name and namespace in other branches
  1. 4.x src/Entity/SolrRequestHandler.php \Drupal\search_api_solr\Entity\SolrRequestHandler::getAsXml()

Gets the Solr Entity definition as XML fragment.

The XML format is used as part of a solrconfig.xml.

Parameters

bool $add_comment: Wether to add a comment to the XML or not to explain the purpose of this Solr Entity.

Return value

string The Solr RequestHandler definition as XML.

Overrides SolrConfigInterface::getAsXml

File

src/Entity/SolrRequestHandler.php, line 107

Class

SolrRequestHandler
Defines the SolrRequestHandler entity.

Namespace

Drupal\search_api_solr\Entity

Code

public function getAsXml(bool $add_comment = TRUE) : string {
  $comment = '';
  if ($add_comment) {
    $comment = "<!--\n  " . $this
      ->label() . "\n  " . $this
      ->getMinimumSolrVersion() . "\n-->\n";
  }
  $formatted_xml_string = $this
    ->buildXmlFromArray('requestHandler', $this->request_handler);
  return $comment . $formatted_xml_string . "\n";
}