-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Use MenuCategoryData to generate array in TopMenu plugin to allow extension via plugins #28715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.4-develop
Are you sure you want to change the base?
Conversation
This is in order to allow additions to the return value of the private method getCategoryAsArray() via a plugin on Magento\Catalog\Observer\MenuCategoryData::getMenuCategoryData()
Hi @fredden. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Injection of Observer
to Plugin
is not the best idea at all.
If you need the logic reusable across these two - just create separate class that provides Interface you need.
|
@magento create issue |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
1 similar comment
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run all tests |
Description
Following discussion on Magento Community Engineering Slack instance, it has become clear that the
private
methodMagento\Catalog\Plugin\Block\Topmenu::getCategoryAsArray()
should be abstracted to allow extension via plugin (as inheritance (via preference) is to be discouraged). It appears that an existing class provides most of the functionality required. This pull request changesgetCategoryAsArray()
to use this existing external class (withpublic
method) to allow this data to be augmented via plugin on the latter.Related Pull Requests
None known
Fixed Issues
None known
Manual testing scenarios
See also discussion on Slack (link above).
getCategoryAsArray()
from external code (third party extension)Questions or comments
I have not yet adjusted any tests, however this should not result in any change in functionality.
Contribution checklist (*)
Resolved issues: