diff --git a/src/Plugin/search_api/processor/AddHierarchy.php b/src/Plugin/search_api/processor/AddHierarchy.php index 2ef94a2..9783579 100644 --- a/src/Plugin/search_api/processor/AddHierarchy.php +++ b/src/Plugin/search_api/processor/AddHierarchy.php @@ -40,13 +40,6 @@ class AddHierarchy extends ProcessorPluginBase implements PluginFormInterface { protected $entityTypeManager; /** - * The fields helper. - * - * @var \Drupal\search_api\Utility\FieldsHelperInterface|null - */ - protected static $fieldsHelper; - - /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { @@ -60,26 +53,6 @@ class AddHierarchy extends ProcessorPluginBase implements PluginFormInterface { } /** - * Retrieves the fields helper. - * - * @return \Drupal\search_api\Utility\FieldsHelperInterface - * The fields helper. - */ - public static function getFieldsHelper() { - return static::$fieldsHelper ?: \Drupal::service('search_api.fields_helper'); - } - - /** - * Sets the fields helper. - * - * @param \Drupal\search_api\Utility\FieldsHelperInterface $fields_helper - * The new fields helper. - */ - public static function setFieldsHelper(FieldsHelperInterface $fields_helper) { - static::$fieldsHelper = $fields_helper; - } - - /** * Retrieves the entity type manager service. * * @return \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager diff --git a/src/Processor/ProcessorPluginBase.php b/src/Processor/ProcessorPluginBase.php index 947ae27..b7fcc68 100644 --- a/src/Processor/ProcessorPluginBase.php +++ b/src/Processor/ProcessorPluginBase.php @@ -51,7 +51,7 @@ abstract class ProcessorPluginBase extends IndexPluginBase implements ProcessorI * * @var \Drupal\search_api\Utility\FieldsHelperInterface|null */ - protected $fieldsHelper; + protected static $fieldsHelper; /** * {@inheritdoc} @@ -60,7 +60,7 @@ abstract class ProcessorPluginBase extends IndexPluginBase implements ProcessorI /** @var static $processor */ $processor = parent::create($container, $configuration, $plugin_id, $plugin_definition); - $processor->setFieldsHelper($container->get('search_api.fields_helper')); + static::setFieldsHelper($container->get('search_api.fields_helper')); return $processor; } @@ -71,8 +71,8 @@ abstract class ProcessorPluginBase extends IndexPluginBase implements ProcessorI * @return \Drupal\search_api\Utility\FieldsHelperInterface * The fields helper. */ - public function getFieldsHelper() { - return $this->fieldsHelper ?: \Drupal::service('search_api.fields_helper'); + public static function getFieldsHelper() { + return static::$fieldsHelper ?: \Drupal::service('search_api.fields_helper'); } /** @@ -83,9 +83,8 @@ abstract class ProcessorPluginBase extends IndexPluginBase implements ProcessorI * * @return $this */ - public function setFieldsHelper(FieldsHelperInterface $fields_helper) { - $this->fieldsHelper = $fields_helper; - return $this; + public static function setFieldsHelper(FieldsHelperInterface $fields_helper) { + static::$fieldsHelper = $fields_helper; } /**