function EntityTranslationRendererBase::getEntity
Same name in other branches
- 10 core/modules/views/src/Entity/Render/EntityTranslationRendererBase.php \Drupal\views\Entity\Render\EntityTranslationRendererBase::getEntity()
Gets the entity associated with a row.
Parameters
\Drupal\views\ResultRow $row: The result row.
string $relationship: (optional) The relationship.
Return value
\Drupal\Core\Entity\EntityInterface|null The entity might be optional, because the relationship entity might not always exist.
5 calls to EntityTranslationRendererBase::getEntity()
- DefaultLanguageRenderer::getLangcodeByRelationship in core/
modules/ views/ src/ Entity/ Render/ DefaultLanguageRenderer.php - Returns the language code associated with the given row.
- EntityTranslationRendererBase::preRenderByRelationship in core/
modules/ views/ src/ Entity/ Render/ EntityTranslationRendererBase.php - Runs before each entity is rendered if a relationship is needed.
- EntityTranslationRendererBase::renderByRelationship in core/
modules/ views/ src/ Entity/ Render/ EntityTranslationRendererBase.php - Renders entity data.
- TranslationLanguageRenderer::preRenderByRelationship in core/
modules/ views/ src/ Entity/ Render/ TranslationLanguageRenderer.php - Runs before each entity is rendered if a relationship is needed.
- TranslationLanguageRenderer::renderByRelationship in core/
modules/ views/ src/ Entity/ Render/ TranslationLanguageRenderer.php - Renders entity data.
File
-
core/
modules/ views/ src/ Entity/ Render/ EntityTranslationRendererBase.php, line 111
Class
- EntityTranslationRendererBase
- Defines a base class for entity translation renderers.
Namespace
Drupal\views\Entity\RenderCode
protected function getEntity(ResultRow $row, string $relationship = 'none') : ?EntityInterface {
if ($relationship === 'none') {
return $row->_entity;
}
elseif (isset($row->_relationship_entities[$relationship])) {
return $row->_relationship_entities[$relationship];
}
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.