Skip to content
Snippets Groups Projects
Commit 7e3a0060 authored by Owen Bush's avatar Owen Bush
Browse files

Updating tokens

parent bd112073
No related branches found
No related tags found
No related merge requests found
......@@ -19,22 +19,22 @@ function recurring_events_token_info() {
];
$eventinstance['title'] = [
'name' => t('Event Title'),
'name' => t('Event Instance Inherited Title'),
'description' => t('The title of the event instance.'),
];
$eventinstance['description'] = [
'name' => t('Event Description'),
'name' => t('Event Instance Inherited Description'),
'description' => t('The description of the event instance.'),
];
$eventinstance['date'] = [
'name' => t('Event Date'),
'name' => t('Event Instance Date'),
'description' => t('The date of the event instance.'),
];
$eventinstance['url'] = [
'name' => t('Event URL'),
'name' => t('Event Instance URL'),
'description' => t('The URL of the event instance.'),
];
......@@ -46,12 +46,12 @@ function recurring_events_token_info() {
];
$eventseries['title'] = [
'name' => t('Event Title'),
'name' => t('Event Series Title'),
'description' => t('The title of the event series.'),
];
$eventseries['description'] = [
'name' => t('Event Description'),
$eventseries['body'] = [
'name' => t('Event Series Body'),
'description' => t('The description of the event series.'),
];
......@@ -78,18 +78,16 @@ function recurring_events_tokens($type, $tokens, array $data, array $options, Bu
foreach ($tokens as $name => $original) {
switch ($name) {
case 'title':
// TODO: Should use the inheritance plugin manager.
$replacements[$original] = $event_instance->getInheritedTitle();
break;
case 'description':
// TODO: Should use the inheritance plugin manager.
$replacements[$original] = $event_instance->getInheritedDescription();
break;
case 'date':
// TODO: Should format according to what?
$replacements[$original] = $event_instance->date->start_date->format('F jS, Y h:iA');
$format = \Drupal::config('recurring_events.eventinstance.config')->get('date_format');
$replacements[$original] = $event_instance->date->start_date->format($format);
break;
case 'url':
......@@ -106,7 +104,7 @@ function recurring_events_tokens($type, $tokens, array $data, array $options, Bu
$replacements[$original] = $event_series->title->value;
break;
case 'description':
case 'body':
$replacements[$original] = $event_series->body->value;
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment