You are here

class ContentEntityFallbackDeriver in Entity Language Fallback 8

Derives a datasource plugin definition for every content entity type.

Hierarchy

Expanded class hierarchy of ContentEntityFallbackDeriver

File

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

Namespace

Drupal\entity_language_fallback\Plugin\search_api\datasource
View source
class ContentEntityFallbackDeriver extends ContentEntityDeriver {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContentEntityDeriver::$derivatives protected property List of derivative definitions. Overrides DeriverBase::$derivatives
ContentEntityDeriver::$entityTypeManager protected property The entity type manager.
ContentEntityDeriver::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
ContentEntityDeriver::getEntityTypeManager public function Retrieves the entity type manager.
ContentEntityDeriver::setEntityTypeManager public function Sets the entity type manager.
ContentEntityFallbackDeriver::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides ContentEntityDeriver::getDerivativeDefinitions
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.