示例#1
0
 /**
  * {@inheritdoc}
  */
 public function __construct(array $configuration, $plugin_id, array $plugin_definition, $query_type_plugin_manager, $search_results_cache)
 {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $query_type_plugin_manager, $search_results_cache);
     // Load facet plugin definition and depending on those settings; load the
     // corresponding search api page and load its index.
     $page_id = $plugin_definition['search_api_page'];
     /* @var $page \Drupal\search_api_page\SearchApiPageInterface */
     $page = SearchApiPageEntity::load($page_id);
     $this->index = Index::load($page->getIndex());
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function __construct(array $configuration, $plugin_id, array $plugin_definition, $query_type_plugin_manager, $search_results_cache)
 {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $query_type_plugin_manager, $search_results_cache);
     // Load facet plugin definition and depending on those settings; load the
     // corresponding view with the correct view with the correct display set.
     // Get that display's query so we can check if this is a Search API based
     // view.
     $view = Views::getView($plugin_definition['view_id']);
     if (!empty($view)) {
         $view->setDisplay($plugin_definition['view_display']);
         $query = $view->getQuery();
         // Only add the index if the $query is a Search API Query.
         if ($query instanceof SearchApiQuery) {
             // Set the Search API Index.
             $this->index = $query->getIndex();
         }
     }
 }