You are here

function entity_embed_test_entity_embed_display_plugins_alter in Entity Embed 8

Implements hook_entity_embed_display_plugins_alter().

1 string reference to 'entity_embed_test_entity_embed_display_plugins_alter'
EntityEmbedHooksTest::testDisplayPluginAlterHooks in tests/src/Functional/EntityEmbedHooksTest.php
Tests hook_entity_embed_display_plugins_alter().

File

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

Code

function entity_embed_test_entity_embed_display_plugins_alter(&$info) {

  // Allow tests to enable or disable this hook.
  if (!\Drupal::state()
    ->get('entity_embed_test_entity_embed_display_plugins_alter', FALSE)) {
    return;
  }

  // Prefix each plugin name with 'testing_hook:'.
  $new_info = [];
  foreach ($info as $key => $value) {
    $new_key = "testing_hook:" . $key;
    $new_info[$new_key] = $info[$key];
    unset($info[$key]);
  }
  $info = $new_info;
}