From ff2ef91c656a8c13d4478b86358e27bd77469c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Rie=C3=9F?= Date: Thu, 16 Apr 2026 09:11:28 +0200 Subject: [PATCH] Add a hasLinks method to Dropdown --- src/Widget/Dropdown.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Widget/Dropdown.php b/src/Widget/Dropdown.php index b6eb20d1b..a449be0f4 100644 --- a/src/Widget/Dropdown.php +++ b/src/Widget/Dropdown.php @@ -60,4 +60,14 @@ protected function assemble() { $this->add(Html::tag('div', ['class' => 'dropdown-menu'], $this->links)); } + + /** + * Check if the dropdown element contains any links + * + * @return bool + */ + public function hasLinks(): bool + { + return ! empty($this->links); + } }