You are here

public function DoubleQuoteWorkaround::validateConfigurationForm in Search API Solr 8.3

Same name and namespace in other branches
  1. 8.2 src/Plugin/search_api/processor/DoubleQuoteWorkaround.php \Drupal\search_api_solr\Plugin\search_api\processor\DoubleQuoteWorkaround::validateConfigurationForm()
  2. 4.x src/Plugin/search_api/processor/DoubleQuoteWorkaround.php \Drupal\search_api_solr\Plugin\search_api\processor\DoubleQuoteWorkaround::validateConfigurationForm()

Form validation handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the complete form.

Overrides FieldsProcessorPluginBase::validateConfigurationForm

See also

\Drupal\Core\Plugin\PluginFormInterface::validateConfigurationForm()

File

src/Plugin/search_api/processor/DoubleQuoteWorkaround.php, line 65

Class

DoubleQuoteWorkaround
Replaces double quotes in field values and query.

Namespace

Drupal\search_api_solr\Plugin\search_api\processor

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::validateConfigurationForm($form, $form_state);
  $replacement = trim($form_state
    ->getValue('replacement'));
  if (mb_strlen($replacement) < 3) {
    $form_state
      ->setErrorByName('replacement', $this
      ->t('The replacement should at least consist of three cahracters.'));
  }
}