You are here

protected function AvatarKitServicesForm::getOperations in Avatar Kit 8.2

Get operations for an avatar service suitable for a operations element.

Parameters

\Drupal\avatars\Entity\AvatarKitServiceInterface $instance: An avatar kit service instance.

Return value

array Get operations for an avatar service instance suitable

1 call to AvatarKitServicesForm::getOperations()
AvatarKitServicesForm::buildForm in src/Form/AvatarKitServicesForm.php
Form constructor.

File

src/Form/AvatarKitServicesForm.php, line 150

Class

AvatarKitServicesForm
Configure Avatar Kit services.

Namespace

Drupal\avatars\Form

Code

protected function getOperations(AvatarKitServiceInterface $instance) : array {
  $operations = [];
  if ($instance
    ->access('update')) {
    $operations['edit'] = [
      'title' => $this
        ->t('Edit'),
      'weight' => 10,
      'url' => $instance
        ->toUrl('edit-form'),
    ];
  }
  if ($instance
    ->access('delete')) {
    $operations['delete'] = [
      'title' => $this
        ->t('Delete'),
      'weight' => 100,
      'url' => $instance
        ->toUrl('delete-form'),
    ];
  }
  return $operations;
}