Get session speakers
This commit is contained in:
parent
704cd757ba
commit
866c548d19
|
@ -10,11 +10,19 @@ class SpeakersExtension extends AbstractExtension
|
|||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
new TwigFunction('speakerSessions', [$this, 'getSpeakerSessions'])
|
||||
new TwigFunction('sessionSpeakers', [$this, 'getSessionSpeakers']),
|
||||
new TwigFunction('speakerSessions', [$this, 'getSpeakerSessions']),
|
||||
];
|
||||
}
|
||||
|
||||
public function getSpeakerSessions($speaker, $sessions): array
|
||||
public function getSessionSpeakers($session, array $speakers): array
|
||||
{
|
||||
return collect($speakers)->filter(function ($speaker) use ($session): bool {
|
||||
return collect($session['speakers'])->contains($speaker['name']);
|
||||
})->values()->toArray();
|
||||
}
|
||||
|
||||
public function getSpeakerSessions($speaker, array $sessions): array
|
||||
{
|
||||
return collect($sessions)->filter(function ($session) use ($speaker): bool {
|
||||
return collect($session['speakers'])->contains($speaker['name']);
|
||||
|
|
Loading…
Reference in a new issue