-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.api.php
43 lines (38 loc) · 938 Bytes
/
next.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
<?php
/**
* @file
* Hooks provided by the Next module.
*/
/**
* @defgroup next_api Next API
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Alter the result of \Drupal\next\Plugin\SitePreviewerInterface::render.
*
* This hook is called after the preview has been assembled.
*
* @param array &$preview
* The preview renderable array from the site_previewer.
* @param array $context
* Context in which the entity is previewed with the following keys:
* - 'plugin': the site_previewer plugin.
* - 'entity': the entity in preview.
* - 'sites': the sites for this entity.
* - 'original_build': the original un-altered build.
*
* @ingroup next_api
*/
function hook_next_site_preview_alter(array &$preview, array $context) {
// Add the entity title before the preview.
$preview['title'] = [
'#markup' => $context['entity']->label(),
'#weight' => -100,
];
}
/**
* @} End of "addtogroup hooks".
*/