You are here

media_test_ckeditor.module in Drupal 8

Helper module for the Media Embed CKEditor plugin tests.

File

core/modules/media/tests/modules/media_test_ckeditor/media_test_ckeditor.module
View source
<?php

/**
 * @file
 * Helper module for the Media Embed CKEditor plugin tests.
 */
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityInterface;

/**
 * Implements hook_entity_view_alter().
 */
function media_test_ckeditor_entity_view_alter(&$build, EntityInterface $entity, EntityViewDisplayInterface $display) {

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

/**
 * Implements hook_preprocess_HOOK().
 */
function media_test_ckeditor_preprocess_media_embed_error(&$variables) {
  $variables['attributes']['class'][] = 'this-error-message-is-themeable';
}