diff --git a/modules/opd_presentations/opd_presentations.module b/modules/opd_presentations/opd_presentations.module index d1244ef41..e2382f26a 100644 --- a/modules/opd_presentations/opd_presentations.module +++ b/modules/opd_presentations/opd_presentations.module @@ -12,7 +12,7 @@ use Drupal\opd_presentations\Entity\Presentation; */ function opd_presentations_entity_bundle_info_alter(array &$bundles): void { if (isset($bundles['node'])) { - $bundles['node']['presentation']['class'] = Presentation::class; + $bundles['node'][Presentation::NODE_TYPE]['class'] = Presentation::class; } if (isset($bundles['paragraph'])) { diff --git a/modules/opd_presentations/src/Entity/Presentation.php b/modules/opd_presentations/src/Entity/Presentation.php index ba5b91724..f541626c9 100644 --- a/modules/opd_presentations/src/Entity/Presentation.php +++ b/modules/opd_presentations/src/Entity/Presentation.php @@ -12,6 +12,8 @@ use Drupal\opd_presentations\Entity\Event; final class Presentation extends Node implements NodeInterface { + public const NODE_TYPE = 'presentation'; + public function getPastEvents(): EventCollection { $events = $this->get('field_events')->referencedEntities(); diff --git a/modules/opd_presentations/tests/src/Traits/PresentationCreationTrait.php b/modules/opd_presentations/tests/src/Traits/PresentationCreationTrait.php index 452e1db4f..d1a9316ee 100644 --- a/modules/opd_presentations/tests/src/Traits/PresentationCreationTrait.php +++ b/modules/opd_presentations/tests/src/Traits/PresentationCreationTrait.php @@ -21,7 +21,7 @@ trait PresentationCreationTrait { private function createPresentation(array $events): Presentation { $presentation = $this->createNode([ 'field_events' => $events, - 'type' => 'presentation', + 'type' => Presentation::NODE_TYPE, ]); assert($presentation instanceof Presentation);