fix(mod_submenu): hide disabled components in mod_submenu#32539
fix(mod_submenu): hide disabled components in mod_submenu#32539sawmurai wants to merge 3 commits intojoomla:4.0-devfrom
Conversation
1c460c7 to
e22e93f
Compare
| * @since 4.0.0 | ||
| */ | ||
| public static function preprocess($parent) | ||
| public static function preprocess($parent, array $disabledExtensions) |
There was a problem hiding this comment.
Probably you should set an empty array as default, so it's not braking if some extension using this call...
|
@SharkyKZ could you please elaborate why you gave a thumb down? Probably there is room for improvement in this PR based on you feedback. Thanks. |
|
I don't know if this is the right approach or not, but it contains a few mistakes:
joomla-cms/administrator/modules/mod_submenu/src/Menu/Menu.php Lines 44 to 46 in 47b2cff As far as I understand the purpose of this PR, only extensions of type "component" should be fetched with that query, and they should be restricted also to the right client_id here (1 for admin).
For lucky circumstances, the "name" and "element" values are the same for (core) components, but that might not always be granted, so it can happen we compare apples and pears here. Therefore at least from a formal point of view the above check is wrong.
|
|
P.S. to my above comment's items 1 and 2: For the reasons stated there, I would expect the query to be: And later below it should be: |
|
@richard67 Thank you so much for the comments! I updated the PR. Let's see what @SharkyKZ's feedback is. This would be my first contribution to joomla despite having used it for the past couple of years, so I would not be surprised if I misunderstood something and my approach is totally wrong. The idea behind my approach is basically: |
|
humm.... |
|
Agreed! Did not know about the ComponentHelper |
|
Yep, I will close it :) |
Pull Request for Issue #32456 .
Summary of Changes
The changes introduced hide menu items for disabled components from the cpanel.
Testing Instructions
Actual result BEFORE applying this Pull Request
The menu item "Content Security Policy" is still available in the cpanel.
Expected result AFTER applying this Pull Request
The menu item "Content Security Policy" is not available in the cpanel anymore.
Documentation Changes Required