From f51d3b809d95c285e0f2e20eae06d6f076889ccc Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 13 Jan 2024 16:02:04 +0100 Subject: [PATCH] Add docs for the new feature that sets custom HTML attributes in menu items and badges --- doc/dashboards.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/dashboards.rst b/doc/dashboards.rst index 95f1a0dea8..2b94c33347 100644 --- a/doc/dashboards.rst +++ b/doc/dashboards.rst @@ -447,14 +447,17 @@ All menu items define the following methods to configure some options: * ``setPermission(string $permission)``, sets the `Symfony security permission`_ that the user must have to see this menu item. Read the :ref:`menu security reference ` for more details. -* ``setBadge($content, string $style='secondary')``, renders the given content +* ``setHtmlAttribute(string $name, mixed $value)``, sets a custom HTML attribute + in the HTML element that renders the menu item. +* ``setBadge($content, string $style='secondary', array $htmlAttributes = [])``, renders the given content as a badge of the menu item. It's commonly used to show notification counts. The first argument can be any value that can be converted to a string in a Twig template (numbers, strings, *stringable* objects, etc.) The second argument is one of the predefined Bootstrap styles (``primary``, ``secondary``, ``success``, ``danger``, ``warning``, ``info``, ``light``, ``dark``) or an arbitrary string content which is passed as the value of the ``style`` attribute of the HTML - element associated to the badge. + element associated to the badge. The third argument allows to set custom + HTML attributes in the element that renders the badge. The rest of options depend on each menu item type, as explained in the next sections.