oliverdavies.uk/modules/opd_presentations/src/Presentation.php

23 lines
493 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace Drupal\opd_presentations;
use Drupal\node\Entity\Node;
use Drupal\node\NodeInterface;
final class Presentation extends Node implements NodeInterface {
2025-06-12 02:10:08 +01:00
public const NODE_TYPE = 'presentation';
public function getPastEvents(): Events {
2025-06-12 02:10:09 +01:00
$events = Events::fromEvents($this->get('field_events')->referencedEntities());
2025-06-10 20:47:23 +01:00
2025-06-12 02:10:08 +01:00
$today = strtotime('today');
2025-06-10 20:47:23 +01:00
2025-06-12 02:10:08 +01:00
return $events->filter(fn (Event $event) => $event->getEventDate() < $today);
}
}