You are here

public function Facet::getWidgetInstance in Facets 8

Returns the facet widget instance.

Return value

\Drupal\facets\Widget\WidgetPluginBase The plugin instance

Overrides FacetInterface::getWidgetInstance

1 call to Facet::getWidgetInstance()
Facet::getQueryType in src/Entity/Facet.php
Returns the query type instance.

File

src/Entity/Facet.php, line 360

Class

Facet
Defines the facet configuration entity.

Namespace

Drupal\facets\Entity

Code

public function getWidgetInstance() {
  if ($this->widget === NULL) {
    throw new InvalidProcessorException();
  }
  if (!isset($this->widgetInstance)) {
    $definition = $this
      ->getWidget();
    $this->widgetInstance = $this
      ->getWidgetManager()
      ->createInstance($definition['type'], (array) $definition['config']);
  }
  return $this->widgetInstance;
}