You are here

public function ContentEntityFallbackDeriver::getDerivativeDefinitions in Entity Language Fallback 8

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides ContentEntityDeriver::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

src/Plugin/search_api/datasource/ContentEntityFallbackDeriver.php, line 15

Class

ContentEntityFallbackDeriver
Derives a datasource plugin definition for every content entity type.

Namespace

Drupal\entity_language_fallback\Plugin\search_api\datasource

Code

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;
}