Ensure that talks given multiple times are only returned once

This commit is contained in:
Oliver Davies 2019-01-18 20:27:50 +00:00
parent 22b70033c5
commit 18e6d2e32f
2 changed files with 28 additions and 11 deletions

View file

@ -9,6 +9,8 @@ use Twig_SimpleFunction;
class TalksExtension extends Twig_Extension
{
const DATE_FORMAT = 'Y-m-d';
/**
* @var string The current date.
*/
@ -34,17 +36,17 @@ class TalksExtension extends Twig_Extension
];
}
/**
* Get all upcoming and previous talks.
*
* @param ProxySourceCollection|array $talks All talk nodes.
* @param array $eventData Shared event data.
*
* @return Collection A sorted collection of talks.
*/
public function getAll($talks, array $eventData = [])
/**
* Get all upcoming and previous talks.
*
* @param ProxySourceCollection|array $talks All talk nodes.
* @param array $eventData Shared event data.
*
* @return Collection A sorted collection of talks.
*/
public function getAll($talks, array $eventData = []): Collection
{
return $this->format($talks, $eventData)->sortBy('event.date');
return collect($talks);
}
/**