OmitNormsCustomTextDataType.php in Search API Solr 8.3
Same filename in this branch
Same filename and directory in other branches
Namespace
Drupal\search_api_solr\Plugin\DerivativeFile
src/Plugin/Derivative/OmitNormsCustomTextDataType.phpView source
<?php
namespace Drupal\search_api_solr\Plugin\Derivative;
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\search_api_solr\Entity\SolrFieldType;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides plugin definitions for custom full text data types which omit norms.
*
* @see \Drupal\search_api_solr\Plugin\search_api\data_type\CustomTextDataType
*/
class OmitNormsCustomTextDataType extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static();
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
foreach (SolrFieldType::getAvailableCustomCodes() as $custom_code) {
$this->derivatives[$custom_code] = $base_plugin_definition;
$this->derivatives[$custom_code]['label'] = $this
->t('Fulltext ":custom_code" Omit norms', [
':custom_code' => $custom_code,
]);
$this->derivatives[$custom_code]['prefix'] .= $custom_code;
}
return $this->derivatives;
}
}
Classes
Name | Description |
---|---|
OmitNormsCustomTextDataType | Provides plugin definitions for custom full text data types which omit norms. |