function EntityOperations::render
Same name in other branches
- 9 core/modules/views/src/Plugin/views/field/EntityOperations.php \Drupal\views\Plugin\views\field\EntityOperations::render()
- 8.9.x core/modules/views/src/Plugin/views/field/EntityOperations.php \Drupal\views\Plugin\views\field\EntityOperations::render()
- 11.x core/modules/views/src/Plugin/views/field/EntityOperations.php \Drupal\views\Plugin\views\field\EntityOperations::render()
Overrides FieldPluginBase::render
File
-
core/
modules/ views/ src/ Plugin/ views/ field/ EntityOperations.php, line 129
Class
- EntityOperations
- Renders all operations links for an entity.
Namespace
Drupal\views\Plugin\views\fieldCode
public function render(ResultRow $values) {
$entity = $this->getEntity($values);
// Allow for the case where there is no entity, if we are on a non-required
// relationship.
if (empty($entity)) {
return '';
}
$entity = $this->getEntityTranslationByRelationship($entity, $values);
$operations = $this->entityTypeManager
->getListBuilder($entity->getEntityTypeId())
->getOperations($entity);
if ($this->options['destination']) {
foreach ($operations as &$operation) {
if (!isset($operation['query'])) {
$operation['query'] = [];
}
$operation['query'] += $this->getDestinationArray();
}
}
$build = [
'#type' => 'operations',
'#links' => $operations,
];
return $build;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.