You are here

DefaultLanguageRenderer.php in Views Parity Row 8

File

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

declare (strict_types=1);
namespace Drupal\views_parity_row\Plugin\views\Entity\Render;

use Drupal\views\ResultRow;

/**
 * Renders entities in the current language.
 */
abstract 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()->id;
  }

}

Classes

Namesort descending Description
DefaultLanguageRenderer Renders entities in the current language.