Builds a renderable list of operation links for the entity.
\Drupal\Core\Entity\EntityInterface $entity: The entity on which the linked operations will be performed.
array A renderable array of operation links.
Drupal\Core\Entity\EntityListController::render()
public function buildOperations(EntityInterface $entity) {
// Retrieve and sort operations.
$operations = $this
->getOperations($entity);
$this->moduleHandler
->alter('entity_operation', $operations, $entity);
uasort($operations, 'drupal_sort_weight');
$build = array(
'#type' => 'operations',
'#links' => $operations,
);
return $build;
}