class DataEntityRow in Drupal 10
Same name and namespace in other branches
- 8 core/modules/rest/src/Plugin/views/row/DataEntityRow.php \Drupal\rest\Plugin\views\row\DataEntityRow
- 9 core/modules/rest/src/Plugin/views/row/DataEntityRow.php \Drupal\rest\Plugin\views\row\DataEntityRow
Plugin which displays entities as raw data.
Plugin annotation
@ViewsRow(
id = "data_entity",
title = @Translation("Entity"),
help = @Translation("Use entities as row data."),
display_types = {"data"}
)
Hierarchy
- class \Drupal\rest\Plugin\views\row\DataEntityRow extends \Drupal\views\Plugin\views\row\RowPluginBase uses EntityTranslationRenderTrait
Expanded class hierarchy of DataEntityRow
File
- core/
modules/ rest/ src/ Plugin/ views/ row/ DataEntityRow.php, line 24
Namespace
Drupal\rest\Plugin\views\rowView source
class DataEntityRow extends RowPluginBase {
use EntityTranslationRenderTrait;
/**
* {@inheritdoc}
*/
protected $usesOptions = FALSE;
/**
* Contains the entity type of this row plugin instance.
*
* @var \Drupal\Core\Entity\EntityTypeInterface
*/
protected $entityType;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* The entity repository service.
*
* @var \Drupal\Core\Entity\EntityRepositoryInterface
*/
protected $entityRepository;
/**
* The entity display repository.
*
* @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface
*/
protected $entityDisplayRepository;
/**
* The language manager.
*
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
/**
* Constructs a new DataEntityRow object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param array $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository
* The entity repository.
*/
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;
}
/**
* {@inheritdoc}
*/
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'));
}
/**
* {@inheritdoc}
*/
public function render($row) {
return $this
->getEntityTranslation($row->_entity, $row);
}
/**
* {@inheritdoc}
*/
public function getEntityTypeId() {
return $this->view
->getBaseEntityType()
->id();
}
/**
* {@inheritdoc}
*/
protected function getEntityTypeManager() {
return $this->entityTypeManager;
}
/**
* {@inheritdoc}
*/
protected function getEntityRepository() {
return $this->entityRepository;
}
/**
* {@inheritdoc}
*/
protected function getLanguageManager() {
return $this->languageManager;
}
/**
* {@inheritdoc}
*/
protected function getView() {
return $this->view;
}
/**
* {@inheritdoc}
*/
public function query() {
parent::query();
$this
->getEntityTranslationRenderer()
->query($this->view
->getQuery());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DataEntityRow:: |
protected | property | The entity display repository. | |
DataEntityRow:: |
protected | property | The entity repository service. | |
DataEntityRow:: |
protected | property | Contains the entity type of this row plugin instance. | |
DataEntityRow:: |
protected | property | The entity type manager. | |
DataEntityRow:: |
protected | property | The language manager. | |
DataEntityRow:: |
protected | property | ||
DataEntityRow:: |
public static | function | ||
DataEntityRow:: |
protected | function | ||
DataEntityRow:: |
public | function |
Returns the entity type identifier. Overrides EntityTranslationRenderTrait:: |
|
DataEntityRow:: |
protected | function | ||
DataEntityRow:: |
protected | function |
Returns the language manager. Overrides EntityTranslationRenderTrait:: |
|
DataEntityRow:: |
protected | function |
Returns the top object of a view. Overrides EntityTranslationRenderTrait:: |
|
DataEntityRow:: |
public | function | ||
DataEntityRow:: |
public | function | ||
DataEntityRow:: |
public | function | Constructs a new DataEntityRow object. | |
EntityTranslationRenderTrait:: |
protected | property | The renderer to be used to render the entity row. | |
EntityTranslationRenderTrait:: |
public | function | Returns the entity translation matching the configured row language. | |
EntityTranslationRenderTrait:: |
protected | function | Returns the current renderer. |