forked from drupal-media/entity_embed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentity_embed.module
More file actions
37 lines (33 loc) · 1.27 KB
/
entity_embed.module
File metadata and controls
37 lines (33 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* @file
* Framework for allowing entities to be embedded using CKEditor plugin and text
* format.
*/
/**
* Implements hook_entity_embed_display_plugins_alter() on behalf of file.module.
*/
function file_entity_embed_display_plugins_alter(array &$plugins) {
// The RSS enclosure field formatter is not usable for Entity Embed.
unset($plugins['file:file_rss_enclosure']);
}
/**
* Implements hook_entity_embed_display_plugins_alter() on behalf of taxonomy.module.
*/
function taxonomy_entity_embed_display_plugins_alter(array &$plugins) {
// The RSS category field formatter is not usable for Entity Embed.
unset($plugins['entity_reference:entity_reference_rss_category']);
}
/**
* Implements hook_entity_embed_display_plugins_for_context_alter().
*
* The 'Rendered entity' formatter can not be used for files unless the
* file_entity module is available.
* @see https://www.drupal.org/node/2468387
* @todo Remove when https://www.drupal.org/node/2567919 is fixed in core.
*/
function entity_embed_entity_embed_display_plugins_for_context_alter(array &$definitions, array $context) {
if ($context['entity_type'] === 'file' && !\Drupal::moduleHandler()->moduleExists('file_entity')) {
unset($definitions['entity_reference:entity_reference_entity_view']);
}
}