Separate menu preparation into its own service

Created on 14 February 2025, 5 months ago

Problem/Motivation

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.

Proposed resolution

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.

✨ Feature request
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States miwayha

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024