You are here

protected function IndexProcessorsForm::getAllProcessors in Search API 8

Retrieves all available processors.

3 calls to IndexProcessorsForm::getAllProcessors()
IndexProcessorsForm::form in src/Form/IndexProcessorsForm.php
Gets the actual form array to be built.
IndexProcessorsForm::submitForm in src/Form/IndexProcessorsForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
IndexProcessorsForm::validateForm in src/Form/IndexProcessorsForm.php
Form validation handler.

File

src/Form/IndexProcessorsForm.php, line 362

Class

IndexProcessorsForm
Provides a form for configuring the processors of a search index.

Namespace

Drupal\search_api\Form

Code

protected function getAllProcessors() {
  $processors = $this->entity
    ->getProcessors();
  $settings['#index'] = $this->entity;
  foreach ($this->processorPluginManager
    ->getDefinitions() as $name => $processor_definition) {
    if (isset($processors[$name])) {
      continue;
    }
    elseif (class_exists($processor_definition['class'])) {
      if (call_user_func([
        $processor_definition['class'],
        'supportsIndex',
      ], $this->entity)) {

        /** @var \Drupal\search_api\Processor\ProcessorInterface $processor */
        $processor = $this->processorPluginManager
          ->createInstance($name, $settings);
        $processors[$name] = $processor;
      }
    }
    else {
      $this->logger
        ->warning('Processor %id specifies a non-existing class %class.', [
        '%id' => $name,
        '%class' => $processor_definition['class'],
      ]);
    }
  }
  return $processors;
}