From 54f16eb60c3e630e9174f6e6839fe2205f2339c9 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Tue, 2 Jul 2024 10:26:42 +0100
Subject: [PATCH] Issue #3456890 by TravisCarden, smustgrave: 'The "%plugin_id"
 was not found' warning message is confusing

---
 core/lib/Drupal/Core/Block/BlockManager.php                   | 2 +-
 .../Core/Config/ConfigImporterMissingContentTest.php          | 4 ++--
 core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php       | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/core/lib/Drupal/Core/Block/BlockManager.php b/core/lib/Drupal/Core/Block/BlockManager.php
index 95f487858cad..a80a31107387 100644
--- a/core/lib/Drupal/Core/Block/BlockManager.php
+++ b/core/lib/Drupal/Core/Block/BlockManager.php
@@ -90,7 +90,7 @@ public function getFallbackPluginId($plugin_id, array $configuration = []) {
    * {@inheritdoc}
    */
   protected function handlePluginNotFound($plugin_id, array $configuration) {
-    $this->logger->warning('The "%plugin_id" was not found', ['%plugin_id' => $plugin_id]);
+    $this->logger->warning('The "%plugin_id" block plugin was not found', ['%plugin_id' => $plugin_id]);
     return parent::handlePluginNotFound($plugin_id, $configuration);
   }
 
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterMissingContentTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterMissingContentTest.php
index 2ab178cbaf62..ed6c87dfbf04 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterMissingContentTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterMissingContentTest.php
@@ -181,12 +181,12 @@ public function testMissingBlockContent(): void {
     $this->logMessages = [];
     $config_importer = $this->configImporter();
     $config_importer->import();
-    $this->assertNotContains('The "block_content:6376f337-fcbf-4b28-b30e-ed5b6932e692" was not found', $this->logMessages);
+    $this->assertNotContains('The "block_content:6376f337-fcbf-4b28-b30e-ed5b6932e692" block plugin was not found', $this->logMessages);
 
     // Ensure the expected message is generated when creating an instance of the
     // block.
     $instance = $this->container->get('plugin.manager.block')->createInstance($plugin_id);
-    $this->assertContains('The "block_content:6376f337-fcbf-4b28-b30e-ed5b6932e692" was not found', $this->logMessages);
+    $this->assertContains('The "block_content:6376f337-fcbf-4b28-b30e-ed5b6932e692" block plugin was not found', $this->logMessages);
     $this->assertInstanceOf(Broken::class, $instance);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php b/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php
index d11b3b8a001f..8aa190f88056 100644
--- a/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php
@@ -114,7 +114,7 @@ public function testGroupedDefinitions(): void {
    * @covers ::handlePluginNotFound
    */
   public function testHandlePluginNotFound(): void {
-    $this->logger->warning('The "%plugin_id" was not found', ['%plugin_id' => 'invalid'])->shouldBeCalled();
+    $this->logger->warning('The "%plugin_id" block plugin was not found', ['%plugin_id' => 'invalid'])->shouldBeCalled();
     $plugin = $this->blockManager->createInstance('invalid');
     $this->assertSame('broken', $plugin->getPluginId());
   }
-- 
GitLab