Skip to content
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

Add settings page #27

Closed
ThierryA opened this issue Dec 1, 2021 · 4 comments · Fixed by #30
Closed

Add settings page #27

ThierryA opened this issue Dec 1, 2021 · 4 comments · Fixed by #30
Assignees
Labels
Infrastructure Issues for the overall performance plugin infrastructure [Type] Feature A new feature within an existing module

Comments

@ThierryA
Copy link
Member

ThierryA commented Dec 1, 2021

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_SCREEN constant) 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 Focus definition (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 modules directory and gathers all available module information from each module's load.php file header. This can largely be copied from the WordPress core function get_plugins() which includes all necessary parsing logic.
  • The screen should be registered with title "Performance Modules" and capability manage_options via add_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, and object-caching, as well as a generic other section.
    • Settings fields should be registered for every available module's enabled sub-setting, associated with the settings section specified in the module's Focus header 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_SETTING option.
  • 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.

@ThierryA ThierryA added [Type] Feature A new feature within an existing module Infrastructure Issues for the overall performance plugin infrastructure Needs Decision labels Dec 1, 2021
@felixarntz
Copy link
Member

Completed the proposed specification in here.

@ThierryA
Copy link
Member Author

ThierryA commented Dec 2, 2021

WordPress settings screen called "Performance Modules"

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
Copy link
Member

felixarntz commented Dec 2, 2021

@ThierryA

What about simply "Settings->Performance", adding module doesn't make much sense for users and can be restrictive?

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?

One requirement which was previously raised is the ability for hosts/developer to bypass the screen and preset modules activation.

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
Copy link
Member Author

ThierryA commented Dec 6, 2021

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?

Yes

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).

SG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Issues for the overall performance plugin infrastructure [Type] Feature A new feature within an existing module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants