diff --git a/src/TwigTweakExtension.php b/src/TwigTweakExtension.php index 36e3004..ad8839c 100644 --- a/src/TwigTweakExtension.php +++ b/src/TwigTweakExtension.php @@ -159,8 +159,10 @@ class TwigTweakExtension extends AbstractExtension { /** * Returns the render array to represent an entity. */ - public static function drupalEntity(string $entity_type, string $selector, string $view_mode = 'full', ?string $langcode = NULL, bool $check_access = TRUE): array { - + public static function drupalEntity(string $entity_type, string $selector = NULL, string $view_mode = 'full', ?string $langcode = NULL, bool $check_access = TRUE): array { + if (empty($selector)) { + return []; + } $storage = \Drupal::entityTypeManager()->getStorage($entity_type); if (Uuid::isValid($selector)) {