Return a token with the name of two guests
This commit is contained in:
parent
487190cb12
commit
bc3f3dd3e5
2 changed files with 9 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ class PodcastTokenTest extends BrowserTestBase {
|
|||
public function podcastNodeProvider(): \Generator {
|
||||
return [
|
||||
yield 'Single guest' => [['Matt Glaman'], 'Matt Glaman'],
|
||||
yield 'Two guests' => [['Emma Horrell', 'Luke McCormick'], 'Emma Horrell and Luke McCormick'],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue