You are here

protected function AccessTokenViewBuilder::alterBuild in Simple OAuth (OAuth2) & OpenID Connect 8

Specific per-entity building.

Parameters

array $build: The render array that is being created.

\Drupal\Core\Entity\EntityInterface $entity: The entity to be prepared.

\Drupal\Core\Entity\Display\EntityViewDisplayInterface $display: The entity view display holding the display options configured for the entity components.

string $view_mode: The view mode that should be used to prepare the entity.

Overrides EntityViewBuilder::alterBuild

File

src/AccessTokenViewBuilder.php, line 19

Class

AccessTokenViewBuilder
Class AccessTokenViewBuilder.

Namespace

Drupal\simple_oauth

Code

protected function alterBuild(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
  parent::alterBuild($build, $entity, $display, $view_mode);
  if ($entity
    ->id()) {
    $build['#contextual_links']['access_token'] = array(
      'route_parameters' => array(
        'access_token' => $entity
          ->id(),
      ),
    );
  }
}