From b9e078a0f3300696309bbdfe9497a1217a3ef4b1 Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Mon, 14 Feb 2022 16:40:23 +0000 Subject: [PATCH] Issue #3259807 by idebr, anneke_vde: #type => 'toolbar_item' without a tab triggers a deprecation notice on PHP8.1 --- core/modules/toolbar/src/Element/ToolbarItem.php | 2 +- .../toolbar/tests/modules/toolbar_test/toolbar_test.module | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/modules/toolbar/src/Element/ToolbarItem.php b/core/modules/toolbar/src/Element/ToolbarItem.php index 7f0216529ca5..2568b824b9b6 100644 --- a/core/modules/toolbar/src/Element/ToolbarItem.php +++ b/core/modules/toolbar/src/Element/ToolbarItem.php @@ -25,7 +25,7 @@ public function getInfo() { ], 'tab' => [ '#type' => 'link', - '#title' => NULL, + '#title' => '', '#url' => Url::fromRoute('<front>'), ], ]; diff --git a/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module b/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module index cbc014054d3c..e399e267ff77 100644 --- a/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module +++ b/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module @@ -45,6 +45,9 @@ function toolbar_test_toolbar() { ], '#weight' => 50, ]; + $items['empty'] = [ + '#type' => 'toolbar_item', + ]; return $items; } -- GitLab