No Code Attached Yet
avatar marcorensch
marcorensch
7 Jul 2023

Steps to reproduce the issue

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

Expected result

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>

Actual result

  1. Error gets thrown if a menu item got created without title / content
  2. There is no way to create divider into the submenus of a component

System information (as much as possible)

  • Joomla 4.3.2
  • PHP 8.2
  • MAMP Installation Apache

Additional comments

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.

See Joomla StackExchange Question for more details

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
4.00

avatar marcorensch marcorensch - open - 7 Jul 2023
avatar marcorensch marcorensch - change - 7 Jul 2023
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 7 Jul 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 7 Jul 2023
avatar marcorensch marcorensch - change - 7 Jul 2023
The description was changed
avatar marcorensch marcorensch - edited - 7 Jul 2023
avatar Irata
Irata - comment - 10 Jul 2023

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 called type.

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.

avatar richard67 richard67 - close - 2 Jan 2024
avatar richard67 richard67 - change - 2 Jan 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-01-02 10:46:02
Closed_By richard67
avatar richard67
richard67 - comment - 2 Jan 2024

Closing as having a pull request. Please test #42588 . Thanks in advance.

Add a Comment

Login with GitHub to post a comment