From a6939bbe3cf4e01ab245bc4cc717cb6aa3681162 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 12 Jul 2025 23:25:52 +0100 Subject: [PATCH] Drupal Bundle classes --- source/_zets/32.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 source/_zets/32.md diff --git a/source/_zets/32.md b/source/_zets/32.md new file mode 100644 index 000000000..89d9beb75 --- /dev/null +++ b/source/_zets/32.md @@ -0,0 +1,60 @@ +--- +title: Drupal Bundle classes +date: 2025-07-12 23:25:52 +tags: + - drupal + - php +--- + +By overridding a given bundle type: + +```php +get('field_date')->value; + } + + public function getEventName(): string { + /** @var non-empty-string */ + return $this->get('field_event_name')->value; + } + + public function isPast(): bool { + return $this->getEventDate() < strtotime('today'); + } + +} +```