You are here

protected function FieldsProcessorPluginBase::processConditionValue in Search API 8

Processes a single condition value.

Called for processing a single condition value. The default implementation just calls process().

Parameters

mixed $value: The condition value to preprocess, as a reference. Can be manipulated directly, nothing has to be returned. Set to an empty string to remove the condition.

2 calls to FieldsProcessorPluginBase::processConditionValue()
FieldsProcessorPluginBase::processConditions in src/Processor/FieldsProcessorPluginBase.php
Preprocesses the query conditions.
TestFieldsProcessorPlugin::processConditionValue in tests/src/Unit/Processor/TestFieldsProcessorPlugin.php
Processes a single condition value.
1 method overrides FieldsProcessorPluginBase::processConditionValue()
TestFieldsProcessorPlugin::processConditionValue in tests/src/Unit/Processor/TestFieldsProcessorPlugin.php
Processes a single condition value.

File

src/Processor/FieldsProcessorPluginBase.php, line 544

Class

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

Namespace

Drupal\search_api\Processor

Code

protected function processConditionValue(&$value) {
  if (is_array($value)) {
    if ($value) {
      foreach ($value as $i => $part) {
        $this
          ->processConditionValue($value[$i]);
        if ($value[$i] !== $part && $value[$i] === '') {
          unset($value[$i]);
        }
      }
      if (!$value) {
        $value = '';
      }
    }
  }
  elseif ($this
    ->shouldProcess($value)) {
    $this
      ->process($value);
  }
}