You are here

public function SearchApiTagCache::getRowCacheTags in Search API 8

Returns the row cache tags.

Parameters

\Drupal\views\ResultRow $row: A result row.

Return value

string[] The row cache tags.

Overrides CachePluginBase::getRowCacheTags

File

src/Plugin/views/cache/SearchApiTagCache.php, line 103

Class

SearchApiTagCache
Defines a tag-based cache plugin for use with Search API views.

Namespace

Drupal\search_api\Plugin\views\cache

Code

public function getRowCacheTags(ResultRow $row) {
  $tags = [];
  foreach ($row->_relationship_objects as $objects) {

    /** @var \Drupal\Core\TypedData\ComplexDataInterface $object */
    foreach ($objects as $object) {
      $entity = $object
        ->getValue();
      if ($entity instanceof EntityInterface) {
        $tags = Cache::mergeTags($tags, $entity
          ->getCacheTags());
      }
    }
  }
  return $tags;
}