No possibility to create divider items in custom component menu.
Create a new Custom component and try to add a menu item of type seperator
like <menu type="seperator"></menu>
. There will no divider be rendered / an error is thrown on installation. First issue is that "Menus items are hardcoded to have "component" type during component installation." (see Sharky's comment here: Link
Using '
' (or similar) should be a valid option for developers to add dividers into their components menu in the sidebar that got rendered like in the com_content menu for example:<li class="divider item-level-3" role="presentation"><span></span></li>
If editing the HTML on Page and adding the HTML Snipped above into the page its rendered correctly so no CSS changes are required only a way to create / parse the "seperator" when used in the component.xml >> menu >> submenu XML structure.
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-01-02 10:46:02 |
Closed_By | ⇒ | richard67 |
The fix to this issue is to update line #1072 of
..\libraries\src\Installer\Adapter\ComponentAdapter.php
by replacing$data['type'] = 'component';
with this line
$data['type'] = ((string) $child->attributes()->type) ?: 'component';
This will result in the
type
field of#__menu
being updated with the value specified in a 'new' attribute of the<menu>
element calledtype
.For example you would be able to specify a type of separator in the manifest.xml
<menu type="separator">----</menu>
The default is to use the current value of 'component' thus there should be no issues created for existing or new entries if
type
is not specified.The dashes/hyphens are not used but there needs to be at least one non-blank character to avoid an error being issued for a missing title as per normal processing.