-
Notifications
You must be signed in to change notification settings - Fork 0
Concept
The WordPress backend is one of the things which makes the system stand out, but, let's be honest, if you're not using a framework or library to create the UI for managing the site's content, you'll be doing the same things over and over again.
That's where the Definitely plugins come into play. Each of these plugins serves a specific area in the WordPress backend and allows developers to create UI and manage data for this area in a simple way. An example of an area would be settings pages, post types with taxonomies, the Customizer, user profiles - there are probably more.
There already exist some plugins which serve the above issues. For example, there is SuperCPT for post types with meta fields, Extended CPTs for post types with enhanced functionality, Meta Box for post type meta boxes with fields or Options Framework for theme options pages.
They all are well-developed and they use WordPress Core methods when possible. I was inspired by them (and not only them), and even some functionality is pretty close to what these plugins do. The thing is just, they are separate. They do not integrate with each other, they all serve one purpose. And that's generally a good thing to do, but I think a common ground for all the functionality would be really helpful. Please note that I'm not trying to say that the above plugins are bad in any way. They're only the reason for me creating these new plugins, in fact the Definitely plugins probably would not exist (or at least not be as useful) if the above plugins wouldn't be here.
Another advantage of a unified way of handling UI in the WordPress backend is that it allows automating development tasks which involve working with that data since we have all information available in a standardized manner. This would, for example, make it possible to dynamically generate endpoints for that new awesome REST API that is now in WordPress Core.
With the concept of the Definitely plugins, I'm trying to create a group of plugins that are based on the same foundation. They all follow the same structural ideas which makes it easy for developers to use them. They all use the same markup for UI elements like fields to ensure that a user's experience within the WordPress admin is seamless. This common foundation, this is exactly what WPDLib is.
All the Definitely plugins follow the same structure. They contain so-called "components" where each component represents an element of the WordPress backend - this can be as different things as an options field, a metabox or even a post type. Basically, everything in these plugins is a component. An important behavior of all components is that they can be nested hierarchically. The way that they can be nested is defined automatically: for example, a field can be a sub-component of a section, but not vice-versa.
Each component has its own PHP class of which you can create as many instances as you like. The base class for all these components is an abstract class contained in WPDLib and has the name WPDLib\Components\ComponentBase
.
WPDLib also bundles a class WPDLib\Components\Menu
which is actually a component that can be used in the WordPress backend - it represents a top-level menu item on the left-hand side. This component is bundled in WPDLib since it is used by multiple plugins.
Another significant portion of WPDLib is that it bundles all field types that are used by any of the Definitely plugins. This means that all the rendering, parsing, validating fields will happen in this common library - thus providing a standardized way to work with fields throughout the whole backend. Please note that those field types are no components themselves - instead they are used by more specific field components of each plugin. That's because, for example handling a field on a settings screen is different from handling a field on a post editing screen.
Anyway, let's not get too much into detail here for now. Let's rather focus on the structure of the API that developers can leverage to actually get something done with the Definitely plugins.
WPDLib is the foundation for all Definitely plugins which allow developers to build their admin interfaces more quickly. Those plugins are: