You are here

public function Index::getTrackerInstance in Search API 8

Retrieves the tracker plugin.

Return value

\Drupal\search_api\Tracker\TrackerInterface The index's tracker plugin.

Throws

\Drupal\search_api\SearchApiException Thrown if the tracker couldn't be instantiated.

Overrides IndexInterface::getTrackerInstance

3 calls to Index::getTrackerInstance()
Index::getAllPlugins in src/Entity/Index.php
Retrieves all the plugins contained in this index.
Index::indexItems in src/Entity/Index.php
Indexes a set amount of items.
Index::writeChangesToSettings in src/Entity/Index.php
Prepares for changes to this index to be persisted.

File

src/Entity/Index.php, line 450

Class

Index
Defines the search index configuration entity.

Namespace

Drupal\search_api\Entity

Code

public function getTrackerInstance() {
  if (!$this->trackerInstance) {
    $tracker_id = $this
      ->getTrackerId();
    $configuration = [];
    if (!empty($this->tracker_settings[$tracker_id])) {
      $configuration = $this->tracker_settings[$tracker_id];
    }
    $this->trackerInstance = \Drupal::getContainer()
      ->get('search_api.plugin_helper')
      ->createTrackerPlugin($this, $tracker_id, $configuration);
  }
  return $this->trackerInstance;
}