ContentEntityFallbackDeriver.php in Entity Language Fallback 8
File
src/Plugin/search_api/datasource/ContentEntityFallbackDeriver.php
View source
<?php
namespace Drupal\entity_language_fallback\Plugin\search_api\datasource;
use Drupal\search_api\Plugin\search_api\datasource\ContentEntityDeriver;
class ContentEntityFallbackDeriver extends ContentEntityDeriver {
public function getDerivativeDefinitions($base_plugin_definition) {
if (!isset($this->derivatives)) {
$plugin_derivatives = parent::getDerivativeDefinitions($base_plugin_definition);
foreach ($plugin_derivatives as &$derivative) {
$derivative['label'] .= $this
->t(' (with language fallback)');
}
$this->derivatives = $plugin_derivatives;
}
return $this->derivatives;
}
}