You are here

function entity_embed_test_entity_view_alter in Entity Embed 8

Implements hook_entity_view_alter().

File

tests/modules/entity_embed_test/entity_embed_test.module, line 93
Helper module for the Entity Embed tests.

Code

function entity_embed_test_entity_view_alter(&$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
  $build['#attributes']['data-entity-embed-test-view-mode'] = $display
    ->getMode();

  // @see \Drupal\Tests\entity_embed\FunctionalJavascript\MediaImageTest::testPreviewUsesDefaultTheme()
  $build['#attributes']['data-entity-embed-test-active-theme'] = \Drupal::theme()
    ->getActiveTheme()
    ->getName();
}