function scheduler_token_info in Scheduler 2.x
Same name and namespace in other branches
- 8 scheduler.tokens.inc \scheduler_token_info()
- 7 scheduler.tokens.inc \scheduler_token_info()
Implements hook_token_info().
File
- ./
scheduler.tokens.inc, line 13 - Builds placeholder replacement tokens for node scheduler data.
Code
function scheduler_token_info() {
$plugin_types = \Drupal::service('scheduler.manager')
->getPluginEntityTypes();
// Initialise the array to avoid 'variable is undefined' phpcs error.
$info = [];
foreach ($plugin_types as $type) {
$info['tokens'][$type]['scheduler-publish'] = [
'name' => t('Publish on date'),
'description' => t("The date the %type will be published.", [
'%type' => $type,
]),
'type' => 'date',
];
$info['tokens'][$type]['scheduler-unpublish'] = [
'name' => t('Unpublish on date'),
'description' => t("The date the %type will be unpublished.", [
'%type' => $type,
]),
'type' => 'date',
];
}
return $info;
}