diff --git a/src/Entity/FacetSource.php b/src/Entity/FacetSource.php index 910521b..14c792e 100644 --- a/src/Entity/FacetSource.php +++ b/src/Entity/FacetSource.php @@ -121,23 +121,6 @@ class FacetSource extends ConfigEntityBase implements FacetSourceInterface { /** * {@inheritdoc} */ - public function getUrlProcessor() { - - // If the instance is already loaded, don't bother trying to reload it, just - // return it. - if ($this->urlProcessorInstance instanceof UrlProcessorInterface) { - return $this->urlProcessorInstance; - } - - $manager = \Drupal::getContainer()->get('plugin.manager.facets.url_processor'); - $this->urlProcessorInstance = $manager->createInstance($this->urlProcessor); - - return $this->urlProcessorInstance; - } - - /** - * {@inheritdoc} - */ public function getUrlProcessorName() { return $this->urlProcessor; } diff --git a/src/FacetSourceInterface.php b/src/FacetSourceInterface.php index a02cac8..8c6e909 100644 --- a/src/FacetSourceInterface.php +++ b/src/FacetSourceInterface.php @@ -47,14 +47,6 @@ interface FacetSourceInterface extends ConfigEntityInterface { public function setUrlProcessor($processor_name); /** - * Returns an instance of the url processor. - * - * @return \Drupal\facets\UrlProcessor\UrlProcessorInterface - * The url processor to be used. - */ - public function getUrlProcessor(); - - /** * Returns a string version of the url processor. * * @return string diff --git a/src/Form/FacetDisplayForm.php b/src/Form/FacetDisplayForm.php index d55dfe1..e096de0 100644 --- a/src/Form/FacetDisplayForm.php +++ b/src/Form/FacetDisplayForm.php @@ -14,6 +14,7 @@ use Drupal\Core\Entity\EntityTypeManager; use Drupal\Core\Form\FormStateInterface; use Drupal\facets\Processor\ProcessorInterface; use Drupal\facets\Processor\ProcessorPluginManager; +use Drupal\facets\UrlProcessor\UrlProcessorInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\facets\Widget\WidgetPluginManager; use Drupal\facets\Processor\WidgetOrderProcessorInterface; @@ -219,7 +220,7 @@ class FacetDisplayForm extends EntityForm { ), ); foreach ($all_processors as $processor_id => $processor) { - if (!($processor instanceof WidgetOrderProcessorInterface)) { + if (!($processor instanceof WidgetOrderProcessorInterface) && !($processor instanceof UrlProcessorInterface)) { $clean_css_id = Html::cleanCssIdentifier($processor_id); $form['facet_settings'][$processor_id]['status'] = array( '#type' => 'checkbox', diff --git a/src/Plugin/facets/processor/UrlProcessorHandler.php b/src/Plugin/facets/processor/UrlProcessorHandler.php index aa653fd..1852a15 100644 --- a/src/Plugin/facets/processor/UrlProcessorHandler.php +++ b/src/Plugin/facets/processor/UrlProcessorHandler.php @@ -52,14 +52,17 @@ class UrlProcessorHandler extends ProcessorPluginBase implements BuildProcessorI /** @var \Drupal\facets\FacetSourceInterface $fs */ $fs = $facet->getFacetSourceConfig(); - $this->processor = $fs->getUrlProcessor(); + $url_processor_name = $fs->getUrlProcessorName(); + + $manager = \Drupal::getContainer()->get('plugin.manager.facets.url_processor'); + $this->processor= $manager->createInstance($url_processor_name, ['facet' => $facet]); } /** * {@inheritdoc} */ public function build(FacetInterface $facet, array $results) { - $this->processor->buildUrls($facet, $results); + return $this->processor->buildUrls($facet, $results); } /**