forked from drupal-media/entity_embed
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentity_embed.api.php
75 lines (66 loc) · 2.04 KB
/
entity_embed.api.php
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* @file
* Hooks provided by the Entity Embed module.
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Alter the display plugin definitions.
*
* @param array &$info
* An associative array containing the plugin definitions keyed by plugin ID.
*/
function hook_entity_embed_display_plugins_alter(array &$info) {
}
/**
* Alter the post_render_cache placeholder context for an embedded entity.
*
* @param array &$context
* The context array.
* @param callable &$callback
* The post-render callback to be used.
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity being rendered.
*/
function hook_entity_embed_context_alter(array &$context, &$callback, \Drupal\Core\Entity\EntityInterface $entity) {
}
/**
* Act on an entity before it is about to be rendered in an embed.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity object.
* @param array $context
* The context array.
*/
function hook_entity_preembed(\Drupal\Core\Entity\EntityInterface $entity, array $context) {
if (isset($context['overrides']) && is_array($context['overrides'])) {
foreach ($context['overrides'] as $key => $value) {
$entity->key = $value;
}
}
}
/**
* Alter the result of \Drupal\entity_embed\EntityEmbedDisplayBase::build().
*
* This hook is called after the content has been assembled in a structured
* array and may be used for doing processing which requires that the complete
* block content structure has been built.
*
* @param array &$build
* A renderable array of data, as returned from the build() implementation of
* the plugin that defined the display.
* @param \Drupal\entity_embed\EntityEmbedDisplayInterface $display
* The entity embed display plugin instance.
*/
function hook_entity_embed_alter(array &$build, \Drupal\entity_embed\EntityEmbedDisplay\EntityEmbedDisplayInterface $display) {
// Remove the contextual links on all entites that provide them.
if (isset($build['#contextual_links'])) {
unset($build['#contextual_links']);
}
}
/**
* @} End of "addtogroup hooks".
*/