Mercurial > hg > isophonics-drupal-site
annotate core/modules/views/src/Entity/Render/ConfigurableLanguageRenderer.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\views\Entity\Render; |
Chris@0 | 4 |
Chris@0 | 5 use Drupal\Core\Entity\EntityTypeInterface; |
Chris@0 | 6 use Drupal\Core\Language\LanguageManagerInterface; |
Chris@0 | 7 use Drupal\views\ResultRow; |
Chris@0 | 8 use Drupal\views\ViewExecutable; |
Chris@0 | 9 |
Chris@0 | 10 /** |
Chris@0 | 11 * Renders entities in a configured language. |
Chris@0 | 12 */ |
Chris@0 | 13 class ConfigurableLanguageRenderer extends EntityTranslationRendererBase { |
Chris@0 | 14 |
Chris@0 | 15 /** |
Chris@0 | 16 * A specific language code for rendering if available. |
Chris@0 | 17 * |
Chris@0 | 18 * @var string|null |
Chris@0 | 19 */ |
Chris@0 | 20 protected $langcode; |
Chris@0 | 21 |
Chris@0 | 22 /** |
Chris@0 | 23 * Constructs a renderer object. |
Chris@0 | 24 * |
Chris@0 | 25 * @param \Drupal\views\ViewExecutable $view |
Chris@0 | 26 * The entity row being rendered. |
Chris@0 | 27 * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager |
Chris@0 | 28 * The language manager. |
Chris@0 | 29 * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type |
Chris@0 | 30 * The entity type. |
Chris@0 | 31 * @param string|null $langcode |
Chris@0 | 32 * A specific language code to set, if available. |
Chris@0 | 33 */ |
Chris@0 | 34 public function __construct(ViewExecutable $view, LanguageManagerInterface $language_manager, EntityTypeInterface $entity_type, $langcode) { |
Chris@0 | 35 parent::__construct($view, $language_manager, $entity_type); |
Chris@0 | 36 $this->langcode = $langcode; |
Chris@0 | 37 } |
Chris@0 | 38 |
Chris@0 | 39 /** |
Chris@0 | 40 * {@inheritdoc} |
Chris@0 | 41 */ |
Chris@0 | 42 public function getLangcode(ResultRow $row) { |
Chris@0 | 43 return $this->langcode; |
Chris@0 | 44 } |
Chris@0 | 45 |
Chris@0 | 46 } |