You are here

public function CoreViewsFacetSourceBase::getAjaxSettingsByFacet in Core Views Facets 8

Optionally get JS settings when AJAX is enabled.

Parameters

\Drupal\facets\FacetInterface $facet: The facet to get settings for.

Return value

array The drupalSettings array.

File

src/Plugin/facets/facet_source/CoreViewsFacetSourceBase.php, line 341

Class

CoreViewsFacetSourceBase
Provide common functions for core Views based facet sources.

Namespace

Drupal\core_views_facets\Plugin\facets\facet_source

Code

public function getAjaxSettingsByFacet(FacetInterface $facet) {
  $this->view
    ->build($this->pluginDefinition['view_display']);
  $filter_handler = $this->view
    ->getHandler($this->view->current_display, 'filter', $facet
    ->getFieldIdentifier());
  return [
    'view_id' => $this->view
      ->id(),
    'current_display_id' => $this->view->current_display,
    'field_id' => $filter_handler['expose']['identifier'],
    'type' => $this
      ->getBaseId(),
    'view_base_path' => ltrim($this->view
      ->getPath(), '/'),
  ];
}