public function YamlFormSubmissionListBuilder::getDefaultOperations in YAML Form 8
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
- src/
YamlFormSubmissionListBuilder.php, line 461
Class
- YamlFormSubmissionListBuilder
- Provides a list controller for yamlform submission entity.
Namespace
Drupal\yamlformCode
public function getDefaultOperations(EntityInterface $entity) {
$base_route_name = $this->requestHandler
->getBaseRouteName($entity, $this->sourceEntity);
$route_parameters = $this->requestHandler
->getRouteParameters($entity, $this->sourceEntity);
$route_options = [
'query' => \Drupal::destination()
->getAsArray(),
];
$operations = [];
if ($entity
->access('update')) {
$operations['edit'] = [
'title' => $this
->t('Edit'),
'weight' => 10,
'url' => Url::fromRoute("{$base_route_name}.yamlform_submission.edit_form", $route_parameters, $route_options),
];
}
if ($entity
->access('view')) {
$operations['view'] = [
'title' => $this
->t('View'),
'weight' => 20,
'url' => Url::fromRoute("{$base_route_name}.yamlform_submission.canonical", $route_parameters),
];
}
if ($entity
->access('update')) {
$operations['notes'] = [
'title' => $this
->t('Notes'),
'weight' => 21,
'url' => Url::fromRoute("{$base_route_name}.yamlform_submission.notes_form", $route_parameters, $route_options),
];
$operations['resend'] = [
'title' => $this
->t('Resend'),
'weight' => 22,
'url' => Url::fromRoute("{$base_route_name}.yamlform_submission.resend_form", $route_parameters, $route_options),
];
}
if ($entity
->access('delete')) {
$operations['delete'] = [
'title' => $this
->t('Delete'),
'weight' => 100,
'url' => Url::fromRoute("{$base_route_name}.yamlform_submission.delete_form", $route_parameters, $route_options),
];
}
return $operations;
}