You are here

protected function SolrFieldType::getSubFieldTypeAsXml in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 src/Entity/SolrFieldType.php \Drupal\search_api_solr\Entity\SolrFieldType::getSubFieldTypeAsXml()

Serializes a filed type as XML fragment as required by Solr.

Parameters

array $field_type:

string $additional_label:

bool $add_comment:

Return value

string

4 calls to SolrFieldType::getSubFieldTypeAsXml()
SolrFieldType::getAsXml in src/Entity/SolrFieldType.php
Gets the Solr Entity definition as XML fragment.
SolrFieldType::getCollatedFieldTypeAsXml in src/Entity/SolrFieldType.php
Gets the Solr Collated Field Type definition as XML fragment.
SolrFieldType::getSpellcheckFieldTypeAsXml in src/Entity/SolrFieldType.php
Gets the Solr Spellcheck Spellcheck Field Type definition as XML fragment.
SolrFieldType::getUnstemmedFieldTypeAsXml in src/Entity/SolrFieldType.php
Gets the Solr Unstemmed Field Type definition as XML fragment.

File

src/Entity/SolrFieldType.php, line 399

Class

SolrFieldType
Defines the SolrFieldType entity.

Namespace

Drupal\search_api_solr\Entity

Code

protected function getSubFieldTypeAsXml(array $field_type, string $additional_label = '', bool $add_comment = TRUE) {
  $formatted_xml_string = $this
    ->buildXmlFromArray('fieldType', $field_type);
  $comment = '';
  if ($add_comment) {
    $comment = "<!--\n  " . $this
      ->label() . $additional_label . "\n  " . $this
      ->getMinimumSolrVersion() . "\n-->\n";
  }
  return $comment . $formatted_xml_string;
}