The new WordPress block editor (also known as Gutenberg) is a radical change for developers used to working with PHP.
The most important arguments discussed in the presentation are the following:
- We have developed a boilerplate to facilitate the adaptation process to WordPress developers. This plugin establishes a foundation for the programming on the block editor including a complete initial configuration for the modern build process.
- Gutenberg provides a lot of reusable components to create user interfaces in JSX. A good practice is to use existing components, instead of programming them from scratch and reinventing the wheel.
registerBlockTypefunction is the most popular one in Gutenberg. It provides the ability to create new blocks in the editor. But there are many more functions that are worth exploring.
registerPluginfunction allows you to add a plugin that extends the editor with a sidebar in which to add the components you want.
subscribefunction allows you to listen to the changes that happen in the block editor and add your own functions that are executed every time a change occurs. You have to be careful and avoid unconditional code with this function to avoid affecting the final performance of the editor.
The following resources were mentioned during the presentation or are useful additional information.
- WordPress Block Editor Boilerplate: base plugin used to extend the WordPress block editor (Gutenberg) with additional blocks or plugins for the editor itself. It includes examples and is well documented.
- JSX tutorial for creating user interfaces: tutorial with examples of the JSX syntax to learn how to create components in React.
- Gutenberg components: Gutenberg package with some of the reusable components that the block editor includes.
- Functions for the editor: functions that Gutenberg provides to access the editor’s data.
- Plugin functions: package that includes functions to extend Gutenberg with plugins.
- Subscribe function: function to listen to the changes that happen in the block editor.
Buzz and feedback
Here’s what was said about this presentation on Twitter: