From dd45c9fe921a805347b571c8e9f1861f88c1f40d Mon Sep 17 00:00:00 2001
From: Philippe Joulot <philippe.joulot@laposte.net>
Date: Mon, 12 Aug 2024 14:33:59 -0700
Subject: [PATCH] Issue #3467716 by phjou: Warning body is empty

---
 token_body_image.module | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/token_body_image.module b/token_body_image.module
index 6a668f8..1c4cc79 100644
--- a/token_body_image.module
+++ b/token_body_image.module
@@ -28,7 +28,7 @@ function token_body_image_tokens($type, $tokens, array $data, array $options, Bu
     foreach ($tokens as $name => $original) {
       switch ($name) {
         case 'body_image_url':
-          $body = $node->get('body')->getValue();
+          $body = (!empty($body)) ? $body[0]['value'] : NULL;
           $body = $body[0]['value'];
           if (!empty($body)) {
             $dom = new DOMDocument();
-- 
GitLab