public function WebformOptionsCustomListBuilder::getDefaultOperations in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_options_custom/src/WebformOptionsCustomListBuilder.php \Drupal\webform_options_custom\WebformOptionsCustomListBuilder::getDefaultOperations()
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 ConfigEntityListBuilder::getDefaultOperations
File
- modules/
webform_options_custom/ src/ WebformOptionsCustomListBuilder.php, line 166
Class
- WebformOptionsCustomListBuilder
- Defines a class to build a listing of webform options custom entities.
Namespace
Drupal\webform_options_customCode
public function getDefaultOperations(EntityInterface $entity, $type = 'edit') {
$operations = parent::getDefaultOperations($entity);
if ($entity
->access('edit')) {
$operations['preview'] = [
'title' => $this
->t('Preview'),
'weight' => 23,
'url' => Url::fromRoute('entity.webform_options_custom.preview_form', [
'webform_options_custom' => $entity
->id(),
]),
];
}
if ($entity
->access('duplicate')) {
$operations['duplicate'] = [
'title' => $this
->t('Duplicate'),
'weight' => 24,
'url' => Url::fromRoute('entity.webform_options_custom.duplicate_form', [
'webform_options_custom' => $entity
->id(),
]),
];
}
if (isset($operations['delete'])) {
$operations['delete']['attributes'] = WebformDialogHelper::getModalDialogAttributes(WebformDialogHelper::DIALOG_NARROW);
}
return $operations;
}