From 7094eab955c278aac45f7031dee2fffd8f3be989 Mon Sep 17 00:00:00 2001
From: SOURABH SISODIA <65231-sourabhsisodia010@users.noreply.drupalcode.org>
Date: Fri, 18 Apr 2025 07:01:35 +0000
Subject: [PATCH] Issue #3518995 by tim-diels: Error when only entering a title
 for the more link and no link is specified

---
 src/Plugin/views/display/ViewsBlockOverride.php | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/Plugin/views/display/ViewsBlockOverride.php b/src/Plugin/views/display/ViewsBlockOverride.php
index 1a802ba..6dd06d1 100644
--- a/src/Plugin/views/display/ViewsBlockOverride.php
+++ b/src/Plugin/views/display/ViewsBlockOverride.php
@@ -488,17 +488,16 @@ class ViewsBlockOverride extends Block implements ContainerFactoryPluginInterfac
       $this->view->setArguments($view_args);
     }
 
-    if (!empty($config['more_link_text'])) {
-      $this->view->display_handler->setOption('use_more', TRUE);
-      $this->view->display_handler->setOption('use_more_text', $config['more_link_text']);
-    }
-
     if (!empty($config['more_link_custom_url'])) {
       $this->view->display_handler->setOption('use_more', TRUE);
       $this->view->display_handler->setOption('link_display', 'custom_url');
       $this->view->display_handler->setOption('link_url', $config['more_link_custom_url']);
     }
 
+    if (!empty($config['more_link_text']) && $this->view->display_handler->getOption('use_more')) {
+      $this->view->display_handler->setOption('use_more_text', $config['more_link_text']);
+    }
+
     return parent::execute();
   }
 
-- 
GitLab