Repository navigation
Add settings page #27
Copy link
Copy link
Closed
Labels
InfrastructureIssues for the overall performance plugin infrastructureIssues for the overall performance plugin infrastructure[Type] FeatureA new feature within an existing moduleA new feature within an existing module
Description
The plugin should provide a simple UI (filterable) to enable/disable modules broken down by focus area.
Requirements
- The plugin's settings screen (slug already defined in
PERFLAB_MODULES_SCREENconstant) should be implemented, with a dynamic list of all modules and a checkbox to toggle each one on/off. - It should be an ordinary WordPress settings screen called "Performance Modules", under "Settings".
- All available modules should be dynamically included in the UI, grouped by their
Focusdefinition (see Define basic module specification #2). - Whether a module is enabled or not should be stored in the plugin's setting already defined as
PERFLAB_MODULES_SETTING.
Specification Details
- A function should be implemented that iterates through the
modulesdirectory and gathers all available module information from each module'sload.phpfile header. This can largely be copied from the WordPress core functionget_plugins()which includes all necessary parsing logic. - The screen should be registered with title "Performance Modules" and capability
manage_optionsviaadd_options_page(). - The screen should be a regular settings page using the WordPress Settings API.
- Settings sections should be registered for the initial focus areas
images,javascript,site-health,measurement, andobject-caching, as well as a genericothersection. - Settings fields should be registered for every available module's
enabledsub-setting, associated with the settings section specified in the module'sFocusheader field. - Any settings sections that don't include any modules / settings fields (yet) should not be displayed.
- Every module's name and description should be displayed with the checkbox to toggle it on/off.
- When submitting the HTML form on the screen, the configuration for which modules are enabled should be saved in the plugin's existing
PERFLAB_MODULES_SETTINGoption.
- Settings sections should be registered for the initial focus areas
- PHPUnit test coverage should be added.
This issue depends on #2 for finalizing the module specification and on #28 for completing the PHPUnit infrastructure necessary to validate that the changes included here work correctly.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
InfrastructureIssues for the overall performance plugin infrastructureIssues for the overall performance plugin infrastructure[Type] FeatureA new feature within an existing moduleA new feature within an existing module
Activity
felixarntz commentedon Dec 1, 2021
Completed the proposed specification in here.
ThierryA commentedon Dec 2, 2021
What about simply "Settings->Performance", adding module doesn't make much sense for users and can be restrictive?
One requirement which was previously raised is the ability for hosts/developer to bypass the screen and preset modules activation.
felixarntz commentedon Dec 2, 2021
@ThierryA
Sounds good! I've put "Performance Modules" as the full title for now, but in the menu it is just "Performance". Does that make sense?
I suggest we do that in a follow-up issue/PR to keep things simple to review. Doing that should be straightforward (e.g. we introduce a filter to control active modules and then only register the settings screen if that filter is not in use).
The PR #30 is ready for review.
ThierryA commentedon Dec 6, 2021
Yes
SG