getLangcodeTable example

/** * {@inheritdoc} */
  public function query(QueryPluginBase $query$relationship = NULL) {
    // In order to render in the translation language of the entity, we need     // to add the language code of the entity to the query. Skip if the site     // is not multilingual or the entity is not translatable.     if (!$this->languageManager->isMultilingual() || !$this->entityType->hasKey('langcode')) {
      return;
    }
    $langcode_table = $this->getLangcodeTable($query$relationship);
    if ($langcode_table) {
      /** @var \Drupal\views\Plugin\views\query\Sql $query */
      $table_alias = $query->ensureTable($langcode_table$relationship);
      $langcode_key = $this->entityType->getKey('langcode');
      $this->langcodeAlias = $query->addField($table_alias$langcode_key);
    }
  }

  /** * Returns the name of the table holding the "langcode" field. * * @param \Drupal\views\Plugin\views\query\QueryPluginBase $query * The query being executed. * @param string $relationship * The relationship used by the entity type. * * @return string * A table name. */
Home | Imprint | This part of the site doesn't use cookies.