Provide a framework for building out react powered settings pages #62094
Replies: 1 comment
-
Using JSON Schema for rendering settings pages is also a powerful option. (Not only, but) Plugin settings are declared using JSON Schema using the WordPress Settings API. The only thing needed is a JSON Schema Form Renderer based on Gutenberg UI. Fortunately we implemented a prototype at CloudFest Hackathon 2024 :-) It costs just a few lines of code to render already registered plugin settings into a beautiful Gutenberg form. GitHub Repo : https://github.com/IONOS-WordPress/cfhack2024-wp-react-jsonschema-form WP Playground Link to see live and in action : https://playground.wordpress.net/?blueprint-url=https://github.com/raw/IONOS-WordPress/cfhack2024-wp-react-jsonschema-form/wp-now-support/playground.json It even contains a JSON Schema playground to play around with the renderer. IONOS plans to continuously make this project feature complete and contribute it to WordPress. |
Beta Was this translation helpful? Give feedback.
-
The Phase 3: Admin Redesign effort aims to slowly revamp the user experience of using WordPress.
One large piece of using WordPress is settings pages. These settings pages get registered in PHP where you get a callback function to then render the markup that gets printed on that admin screen.
It technically is already possible today to register all of the
@wordpress/
packages that are bundled and instantiate a custom react app on that screen to power your custom settings page. In fact that is how WordPress core handles loading all the instances of the block editor already today. (See the Site Editor for example:gutenberg/packages/edit-site/src/index.js
Line 33 in a12fa90
)
However, setting that up custom for every single settings page that is out there is a lot of repetitive error-prone scaffolding code.
We already see various plugins starting to adopt this pattern of react-powered setting screens that use the
@wordpress/components
and even the@wordpress/data-views
to create user experiences that match what core itself produces in the Site Editor.Given that as part of the overall Admin Redesign we need to find a way to make this settings page creation easier anyway I think this would be a great area of exploration to see if we can abstract a lot of the manual, repetitive work here into a simpler API in core that allows developers to register these react powered settings screens that use a full navigation controller with tabs etc.
Doing this now allows plugin developers to start adopting this new paradigm before we eventually start to roll out the new "Frame" of the admin redesign and therefore will create a much smoother upgrade path and therefore a less fragmented experience of users.
Essentially, can we start building an API for plugins to build whats is highlighted here:
![CleanShot 2024-05-29 at 13 29 16@2x](https://private-user-images.githubusercontent.com/20684594/334780525-1cc3a594-d753-4c51-8243-5c750c229661.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMjkyMjEsIm5iZiI6MTcyNDEyODkyMSwicGF0aCI6Ii8yMDY4NDU5NC8zMzQ3ODA1MjUtMWNjM2E1OTQtZDc1My00YzUxLTgyNDMtNWM3NTBjMjI5NjYxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIwVDA0NDIwMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFjZGU5YWY2MGNiOWIxNTZmZmE3Y2JkNjI3NzllY2FiMDcxMjJiMDdlZTYzMGQwNmNhY2IwYzM2MzBiYTczNjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.yFE8Qe0b83f1hFhzTiy9hXMsbFberiVop9193pw6MHo)
Beta Was this translation helpful? Give feedback.
All reactions