You are here

public function ProfileListBuilder::getDefaultOperations in Profile 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/ProfileListBuilder.php, line 138

Class

ProfileListBuilder
List controller for profiles.

Namespace

Drupal\profile

Code

public function getDefaultOperations(EntityInterface $entity) {
  $operations = parent::getDefaultOperations($entity);
  $destination = $this->redirectDestination
    ->getAsArray();
  foreach ($operations as $key => $operation) {
    $operations[$key]['query'] = $destination;
  }

  /** @var \Drupal\profile\Entity\ProfileInterface $entity */
  if ($entity
    ->access('update') && $entity
    ->isPublished() && !$entity
    ->isDefault()) {
    $operations['set_default'] = [
      'title' => $this
        ->t('Mark as default'),
      'url' => $entity
        ->toUrl('set-default'),
      'parameter' => $entity,
      'weight' => 20,
    ];
  }
  return $operations;
}