From 2a797ad166e5055ef932396efd9e4ad57926b11b Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Wed, 27 Mar 2024 13:15:53 +0000
Subject: [PATCH] Issue #3433268 by Lendude, smustgrave, longwave, alexpott:
 Use plugin short_title for admin summary in ViewsArgumentDefault

---
 .../Plugin/views/argument/ArgumentPluginBase.php  | 15 +++++++++++++++
 .../src/Functional/Plugin/ArgumentDefaultTest.php |  1 +
 2 files changed, 16 insertions(+)

diff --git a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
index c5e50c7cdfd1..68ce5582556d 100644
--- a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
+++ b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
@@ -1392,6 +1392,21 @@ public function getContextDefinition() {
     return $this->getPlugin('argument_validator')->getContextDefinition();
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function adminSummary() {
+    // If an argument default has been set, show which argument default has been
+    // set.
+    if ($this->options['default_action'] === 'default') {
+      $plugin = $this->getPlugin();
+      if ($plugin) {
+        return $this->t('Default: @plugin_title', ['@plugin_title' => $plugin->pluginTitle()]);
+      }
+    }
+    return '';
+  }
+
 }
 
 /**
diff --git a/core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php b/core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php
index aa3cc293757a..0628fbc7dc5f 100644
--- a/core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php
@@ -73,6 +73,7 @@ public function testArgumentDefaultPlugin() {
     $id = $view->addHandler('default', 'argument', 'views_test_data', 'name', $options);
     $view->initHandlers();
     $plugin = $view->argument[$id]->getPlugin('argument_default');
+    $this->assertEquals('Default: Argument default test', $view->argument[$id]->adminSummary());
     $this->assertInstanceOf(ArgumentDefaultTestPlugin::class, $plugin);
 
     // Check that the value of the default argument is as expected.
-- 
GitLab