public function EntityOperations::render in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/field/EntityOperations.php \Drupal\views\Plugin\views\field\EntityOperations::render()
- 9 core/modules/views/src/Plugin/views/field/EntityOperations.php \Drupal\views\Plugin\views\field\EntityOperations::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
->getEntityTranslation($this
->getEntity($values), $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;
}