Return a token with the name of two guests

This commit is contained in:
Oliver Davies 2025-05-29 23:49:17 +01:00
parent 487190cb12
commit bc3f3dd3e5
2 changed files with 9 additions and 0 deletions

View file

@ -80,6 +80,14 @@ function opd_podcast_tokens(string $type, array $tokens, array $data, array $opt
assert(!is_null($guests[0]));
assert($guests[0] instanceof TermInterface);
// TODO: allow for more than two guests.
if (count($guests) === 2) {
assert($guests[1] instanceof TermInterface);
$replacements[$original] = sprintf('%s %s %s', $guests[0]->label(), t('and'), $guests[1]->label());
break;
}
$replacements[$original] = $guests[0]->label();
break;
}