public function EntityReferenceFilterViewResult::getCacheTags in Views Reference Filter 8
The cache tags associated with this object.
When this object is modified, these cache tags will be invalidated.
Return value
string[] A set of cache tags.
Overrides FilterPluginBase::getCacheTags
File
- src/
Plugin/ views/ filter/ EntityReferenceFilterViewResult.php, line 706
Class
- EntityReferenceFilterViewResult
- Filter by entity id using items got from the another view..
Namespace
Drupal\entityreference_filter\Plugin\views\filterCode
public function getCacheTags() {
// Adds entityreference view base entity as cache tag.
$reference_display = $this->options['reference_display'] ?? FALSE;
if ($reference_display) {
[
$view_name,
] = explode(':', $reference_display);
/** @var \Drupal\views\Entity\View $config */
$config = $this->viewStorage
->load($view_name);
if ($config && $config instanceof View) {
$definitions = $this->entityTypeManager
->getDefinitions();
foreach ($definitions as $definition) {
$base_table_view = $config
->get('base_table');
if ($definition instanceof ContentEntityTypeInterface) {
$base_table_entity = $definition
->getDataTable();
if (!$base_table_entity) {
$base_table_entity = $definition
->getBaseTable();
}
if ($base_table_entity === $base_table_view) {
return $definition
->getListCacheTags();
}
}
}
}
}
return parent::getCacheTags();
}