You are here

public function Query::getDisplayPlugin in Search API 8

Retrieves the search display associated with this query (if any).

If the search ID set for this query corresponds to a display plugin ID, that display will be returned. Otherwise, NULL is returned.

Return value

\Drupal\search_api\Display\DisplayInterface|null The search display associated with this query, if any; NULL otherwise.

Overrides QueryInterface::getDisplayPlugin

File

src/Query/Query.php, line 370

Class

Query
Provides a standard implementation for a Search API query.

Namespace

Drupal\search_api\Query

Code

public function getDisplayPlugin() {
  $display_manager = $this
    ->getDisplayPluginManager();
  if (isset($this->searchId) && $display_manager
    ->hasDefinition($this->searchId)) {
    return $display_manager
      ->createInstance($this->searchId);
  }
  return NULL;
}