Same filename and directory in other branches
- 10 core/modules/rest/src/Plugin/views/row/DataEntityRow.php
- 8.9.x core/modules/rest/src/Plugin/views/row/DataEntityRow.php
Namespace
Drupal\rest\Plugin\views\row
File
core/modules/rest/src/Plugin/views/row/DataEntityRow.php
View source
<?php
namespace Drupal\rest\Plugin\views\row;
use Drupal\Core\Entity\EntityRepositoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\views\Entity\Render\EntityTranslationRenderTrait;
use Drupal\views\Plugin\views\row\RowPluginBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
class DataEntityRow extends RowPluginBase {
use EntityTranslationRenderTrait;
protected $usesOptions = FALSE;
protected $entityType;
protected $entityTypeManager;
protected $entityRepository;
protected $entityDisplayRepository;
protected $languageManager;
public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, EntityRepositoryInterface $entity_repository) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityTypeManager = $entity_type_manager;
$this->languageManager = $language_manager;
$this->entityRepository = $entity_repository;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('entity_type.manager'), $container
->get('language_manager'), $container
->get('entity.repository'));
}
public function render($row) {
return $this
->getEntityTranslation($row->_entity, $row);
}
public function getEntityTypeId() {
return $this->view
->getBaseEntityType()
->id();
}
protected function getEntityTypeManager() {
return $this->entityTypeManager;
}
protected function getEntityRepository() {
return $this->entityRepository;
}
protected function getLanguageManager() {
return $this->languageManager;
}
protected function getView() {
return $this->view;
}
public function query() {
parent::query();
$this
->getEntityTranslationRenderer()
->query($this->view
->getQuery());
}
}
Classes