diff --git a/src/Entity/Facet.php b/src/Entity/Facet.php index 13b05f8..e9b64b9 100644 --- a/src/Entity/Facet.php +++ b/src/Entity/Facet.php @@ -628,14 +628,13 @@ class Facet extends ConfigEntityBase implements FacetInterface { * {@inheritdoc} */ public function getProcessorsByStage($stage, $only_enabled = TRUE) { - $processors = $this->loadProcessors(); + $processors = $this->getProcessors($only_enabled); $processor_settings = $this->getProcessorConfigs(); $processor_weights = array(); - // Get a list of all processors meeting the criteria (stage and, optionally, - // enabled) along with their effective weights (user-set or default). + // Get a list of all processors for given stage. foreach ($processors as $name => $processor) { - if ($processor->supportsStage($stage) && !($only_enabled && empty($processor_settings[$name]))) { + if ($processor->supportsStage($stage)) { if (!empty($processor_settings[$name]['weights'][$stage])) { $processor_weights[$name] = $processor_settings[$name]['weights'][$stage]; } diff --git a/src/FacetManager/DefaultFacetManager.php b/src/FacetManager/DefaultFacetManager.php index a044f6b..a377e64 100644 --- a/src/FacetManager/DefaultFacetManager.php +++ b/src/FacetManager/DefaultFacetManager.php @@ -289,22 +289,16 @@ class DefaultFacetManager { $active_sorts = []; - // Load all processors, because getProcessorsByStage does not return the - // correct configuration for the processors. - // @todo: Fix when https://www.drupal.org/node/2722267 is fixed. - $processors = $facet->getProcessors(); foreach ($facet->getProcessorsByStage(ProcessorInterface::STAGE_BUILD) as $processor) { - /** @var \Drupal\facets\Processor\BuildProcessorInterface $build_processor */ - $build_processor = $this->processorPluginManager->createInstance($processor->getPluginDefinition()['id'], ['facet' => $facet]); - if ($build_processor instanceof WidgetOrderProcessorInterface) { + if ($processor instanceof WidgetOrderProcessorInterface) { // Sorting is handled last and together, to support nested sorts. - $active_sorts[] = $processors[$build_processor->getPluginId()]; + $active_sorts[] = $processor; } else { - if (!$build_processor instanceof BuildProcessorInterface) { + if (!$processor instanceof BuildProcessorInterface) { throw new InvalidProcessorException("The processor {$processor->getPluginDefinition()['id']} has a build definition but doesn't implement the required BuildProcessorInterface interface"); } - $results = $build_processor->build($facet, $results); + $results = $processor->build($facet, $results); } } uasort($results, function ($a, $b) use ($active_sorts) {