- Issue created by @miwayha
RestMenuItemsResource::get() is responsible for both assembling the data and building a response.
I have a case where I'd like the data that RestMenuItemsResource::get() provides, but not as a response. Specifically, RestMenuItemsResource::getMenuItems() and RestMenuItemsResource::getElementvalue() are doing a lot of interesting work that I'd like to keep.
However, it isn't easy to reuse that code, given they are within protected methods which are in a plugin.
Move the functionality of building the menu into a service, inject the service into the plugin. Call the service from within RestMenuItemsResource::get(). That way, other modules can take advantage of that functionality.
Active
3.0
Code