protected function OrderListBuilder::getDefaultOperations in Commerce Core 8.2
Gets this list's default operations.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity the operations are for.
Return value
array The array structure is identical to the return value of self::getOperations().
Overrides EntityListBuilder::getDefaultOperations
File
- modules/
order/ src/ OrderListBuilder.php, line 107
Class
- OrderListBuilder
- Defines the list builder for orders.
Namespace
Drupal\commerce_orderCode
protected function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
/** @var \Drupal\commerce_order\Entity\OrderInterface $entity */
if ($entity
->access('view')) {
$operations['view'] = [
'title' => $this
->t('View'),
'weight' => 5,
'url' => $entity
->toUrl('canonical'),
];
}
if ($entity
->access('update') && $entity
->hasLinkTemplate('reassign-form')) {
$operations['reassign'] = [
'title' => $this
->t('Reassign'),
'weight' => 20,
'url' => $this
->ensureDestination($entity
->toUrl('reassign-form')),
];
}
if ($entity
->access('unlock')) {
$operations['unlock'] = [
'title' => $this
->t('Unlock'),
'weight' => 25,
'url' => $this
->ensureDestination($entity
->toUrl('unlock-form')),
];
}
if ($entity
->access('resend_receipt')) {
$operations['resend_receipt'] = [
'title' => $this
->t('Resend receipt'),
'weight' => 20,
'url' => $this
->ensureDestination($entity
->toUrl('resend-receipt-form')),
];
}
return $operations;
}