You are here

public function WebformImageSelectImagesListBuilder::getDefaultOperations in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_image_select/src/WebformImageSelectImagesListBuilder.php \Drupal\webform_image_select\WebformImageSelectImagesListBuilder::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_image_select/src/WebformImageSelectImagesListBuilder.php, line 158

Class

WebformImageSelectImagesListBuilder
Defines a class to build a listing of webform image select images entities.

Namespace

Drupal\webform_image_select

Code

public function getDefaultOperations(EntityInterface $entity, $type = 'edit') {
  $operations = parent::getDefaultOperations($entity);
  if ($entity
    ->access('duplicate')) {
    $operations['duplicate'] = [
      'title' => $this
        ->t('Duplicate'),
      'weight' => 20,
      'url' => Url::fromRoute('entity.webform_image_select_images.duplicate_form', [
        'webform_image_select_images' => $entity
          ->id(),
      ]),
    ];
  }
  if (isset($operations['delete'])) {
    $operations['delete']['attributes'] = WebformDialogHelper::getModalDialogAttributes(WebformDialogHelper::DIALOG_NARROW);
  }
  return $operations;
}