-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathlocalgov_publications.tokens.inc
More file actions
32 lines (28 loc) · 1015 Bytes
/
localgov_publications.tokens.inc
File metadata and controls
32 lines (28 loc) · 1015 Bytes
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
<?php
/**
* @file
* Provides tokens for publications related data.
*/
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\localgov_publications\Token\Hooks as TokenHooks;
/**
* Implements hook_token_info().
*/
function localgov_publications_token_info_alter(&$data) {
$data['tokens']['node']['localgov-publication-cover-page-alias'] = [
'name' => t("Cover page path"),
'description' => t("The path of the publication cover page."),
];
$data['tokens']['node']['localgov-publication-path'] = [
'name' => t("Publication path"),
'description' => t("The path to a publication page. Includes the cover page if there is one and respects existing aliases."),
];
}
/**
* Implements hook_tokens_alter().
*/
function localgov_publications_tokens_alter(array &$replacements, array $context, BubbleableMetadata $bubbleable_metadata) {
\Drupal::service('class_resolver')
->getInstanceFromDefinition(TokenHooks::class)
->tokensAlter($replacements, $context, $bubbleable_metadata);
}