You are here

protected function FieldsProcessorPluginBase::testField in Search API 8

Tests whether a certain field should be processed.

Parameters

string $name: The field's ID.

\Drupal\search_api\Item\FieldInterface $field: The field's information.

Return value

bool TRUE if the field should be processed, FALSE otherwise.

5 calls to FieldsProcessorPluginBase::testField()
FieldsProcessorPluginBase::buildConfigurationForm in src/Processor/FieldsProcessorPluginBase.php
Form constructor.
FieldsProcessorPluginBase::preprocessIndexItems in src/Processor/FieldsProcessorPluginBase.php
Preprocesses search items for indexing.
FieldsProcessorPluginBase::processConditions in src/Processor/FieldsProcessorPluginBase.php
Preprocesses the query conditions.
Stemmer::preprocessIndexItems in src/Plugin/search_api/processor/Stemmer.php
Preprocesses search items for indexing.
TestFieldsProcessorPlugin::testField in tests/src/Unit/Processor/TestFieldsProcessorPlugin.php
Tests whether a certain field should be processed.
1 method overrides FieldsProcessorPluginBase::testField()
TestFieldsProcessorPlugin::testField in tests/src/Unit/Processor/TestFieldsProcessorPlugin.php
Tests whether a certain field should be processed.

File

src/Processor/FieldsProcessorPluginBase.php, line 472

Class

FieldsProcessorPluginBase
Provides a base class for processors that work on individual fields.

Namespace

Drupal\search_api\Processor

Code

protected function testField($name, FieldInterface $field) {
  if (!isset($this->configuration['fields'])) {
    return !$field
      ->isHidden() && $this
      ->testType($field
      ->getType());
  }
  return in_array($name, $this->configuration['fields'], TRUE);
}