You are here

DefaultLanguageRenderer.php in Display Suite 8.3

File

src/Plugin/views/Entity/Render/DefaultLanguageRenderer.php
View source
<?php

namespace Drupal\ds\Plugin\views\Entity\Render;

use Drupal\views\ResultRow;

/**
 * Renders entities in the current language.
 */
class DefaultLanguageRenderer extends RendererBase {

  /**
   * Returns the language code associated to the given row.
   *
   * @param \Drupal\views\ResultRow $row
   *   The result row.
   *
   * @return string
   *   A language code.
   */
  public function getLangcode(ResultRow $row) {
    return $row->_entity
      ->getUntranslated()
      ->language()
      ->getId();
  }

}

Classes

Namesort descending Description
DefaultLanguageRenderer Renders entities in the current language.