You are here

protected function TeamListBuilder::getDefaultOperations in Apigee Edge 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

modules/apigee_edge_teams/src/Entity/ListBuilder/TeamListBuilder.php, line 61

Class

TeamListBuilder
General entity listing builder for teams.

Namespace

Drupal\apigee_edge_teams\Entity\ListBuilder

Code

protected function getDefaultOperations(EntityInterface $entity) {
  $operations = parent::getDefaultOperations($entity);
  $team_app_list_url = Url::fromRoute('entity.team_app.collection_by_team', [
    'team' => $entity
      ->id(),
  ]);
  if ($team_app_list_url
    ->access()) {
    $team_app_entity_def = $this->entityTypeManager
      ->getDefinition('team_app');
    $operations['apps'] = [
      'title' => $team_app_entity_def
        ->getCollectionLabel(),
      'url' => $team_app_list_url,
      'weight' => -10,
    ];
  }
  if ($entity
    ->hasLinkTemplate('members')) {
    $members_url = $entity
      ->toUrl('members');
    if ($members_url
      ->access()) {
      $operations['members'] = [
        'title' => $this
          ->t('Members'),
        'url' => $members_url,
      ];
    }
  }
  return $operations;
}