-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Introduce 'block-editor' post type supports attribute for custom post types with custom controllers #2457
Comments
I agree, but I suggest that a descriptive declaration such as "block-editor" is more applicable as "gutenberg" is a project name and stands out amid the other declarations. |
Good point @steveangstrom Most likely we'll want to make sure "block-editor" overrides "editor" if both are declared accidentally as well. |
Pretty sure that is the intent of the block editor ( Gutenberg ), even though it might not be clear because the link is added. A lot of the WordPress end of things have yet to be ironed out/polished as the interactions within Gutenberg are the main focus of development for now. Polish, will be coming soonish! |
@mathetos I do agree this would avoid some of the most complicated compatibility issues, but in the end I think it leads us toward a tale of two WP Admins. We need to think through the side effects of declaring support for one type of editor or another. Gutenberg, as it exists today, is a full-screen replacement, which means toggling support for it affects not just the editor, but also what hooks are available and how meta boxes work. The internals and appearance of the entire sidebar change as well. By not declaring support for Gutenberg, we preserve the interfaces that exist today, but at what cost? Here are some of the harmful side effects:
I've been mulling over a solution like this for a few months, but ultimately the scope creep of the editor out into the edit screen means that declaring support for one editor or another isn't as straightforward as it sounds. Instead it seems to replace a major problem with several smaller ones. |
This issue is made with the assumption that Gutenberg will be introduced into Core. This issue isn't creating a problem, its helping navigate a way forward in light of the current trajectory of the project. Generally speaking, I only see a few options for what that might look like currently:
The third option -- which I'm suggesting -- seems the most reasonable as well as backward compatible. That is of course unless something drastic changes between now and when Gutenberg is ready for Core integration, which might be the case; you never know. |
I see two major challenges facing Gutenberg, the first based on the past and the second on the future:
Declaring Gutenberg support for a post type solves the first goal, but it creates two separate admin experiences going forward. This is what I mean by solving one problem by introducing another.
This is great for the author of the post type, but any other developer attempting to extend the functionality of the post type does not have knowledge of the editor type and therefore would have to prepare their plugin for both legacy and Gutenberg scenarios. Many plugins don't define post types at all as their entire purpose is to extend any post type's functionality. For example's sake, let's say I'm a modern developer and I convert my plugin's shortcode to a Gutenberg block like many other contributors are suggesting. But then I find out that most of my existing customers are using this legacy interface. Now any future development on my plugin has to include maintenance and updates for both new and old implementations with no plan for future convergence. Imagine writing documentation for your plugin's shortcode-turned-block two completely different ways for Gutenberg and legacy users, and expecting the user to know which is which. Or having to ask users whether they are using the Gutenberg interface or the legacy interface in order to properly debug an issue. Or even worse, what if one user has multiple post types on their site, some of which use Gutenberg and others which use legacy mode? Now the same customer has to learn how to use your plugin two different ways by inserting a shortcode in one post type and a block in another. |
@kevinwhoffman that's a good summary of the main challenges. The thing is though, that the problem of breaking existing sites is entirely created by the Gutenberg project itself wanting to move forward so quickly and having such a large scope (especially forcing meta boxes into "legacy", whatever that will mean). Creating a constant admin experience is important of course. But not breaking half of all existing Wordpress sites would seem more important at the moment. |
A Worth noting gutenberg already handles when a post type doesn't support |
I'm not wild about the opt-in option for CPTs. I like the I'm also interested in ways we can detect whether a particular CPT is going to work in Gutenberg, similar to meta boxes. I'd like to see some examples of CPT usage that declares |
I think if we can get more and more meta boxes to work, this problem sort of goes away. The main breakage I see is all meta box related. Originally I was more on the opt-in train of thought, but after seeing how things are playing out, I think opt-out would be ideal, if we can minimize the problems surrounding meta boxes. |
I too believe opt-out would be a better approach. CPTs should start at least with the same editing options than regular posts. You might want to opt out if the CPT is layout-specific though, but their aim is often only taxonomies. |
Will be there a possibility for theme and plugin authors to label the plugin as "Gutenberg-ready" in the repository? If yes, is the information viewable in the plugin repo api or in the frontend like "Last updated: ", "Tested up to: ", ...? |
@BE-Webdesign would it not make sense to have opt-in until the Meta Box issue is solved then move to opt-out. That solves both issues of not breaking things and moving towards a consistent admin experience. |
It seems that one part of the argument that's starkly missing from the discussion here is the case where a custom post type doesn't even use the editor, for instance. Maybe it's just a collection of custom meta boxes or even a custom editing experience. That would be a case where i would want to explicitly exclude a custom post type from Gutenberg "support". It's one thing to replace the experience of editing written or embedded content in the editor with editing written or embedded content in Gutenberg, it's another entirely to replace what could be a completely asynchronous, non-linear editing experience with something like Gutenberg. Apples to oranges is probably OK, apples to potatoes, probably not so much. What if anything is going to be the current approach on allowing (or disallowing) post types to "opt-in" to Gutenberg/block-editor support? |
CPTs don't opt-in to Gutenberg support, they opt-out. Currently, that's by declaring that they don't support I don't mind the option of 5.0 landing with the current behaviour, that CPTs will use Classic if they don't support CPTs that provide a custom interface are not affected by Gutenberg. The |
Noted. For what it's worth, this is the first time I've heard of the |
@pento Can you clarify when you would use the |
Sure, The current Core behaviour when your CPT removes For 5.0, I was considering the option of having CPTs that remove |
For CPTs that do not declare In comparison, shortcodes and widgets are easier to blockify, and based on observation, that is where most plugins are focusing their first steps into Gutenberg. |
So, I'm working on a project where I want to use a Gutenberg layout, with all fixed/locked blocks that store in postmeta. It took me a while to realize that Gutenberg wasn't showing up because I didn't have Just throwing out there that "editor" support is (in my opinion) tightly coupled to So I'd suggest there be an additional That way, other plugins that assume |
^ perhaps I'm mistaken. Even blocks that store to |
^ I'm correcting myself again. In my case, I have a post_type that pulls data in from a 3rd party API and the data should not be mutable in the wp-admin, but it should be viewable. So, I will be using Gutenblocks to display read-only data. So, no data will be stored in post_content at all, but I still want Gutenberg as the interface. So, Gutenberg isn't necessarily tightly coupled with post_content, where "editor" is. Still vote to have a more explicit "supports" declaration for Gutenberg. Possibly with some fallback to editor. But more explicit is better in my opinion. |
Related #3462 |
This is an old issue (I probably was thinking too far ahead when I wrote it), and we've had a lot of discussion and a TON of development has happened since this all started. So, how about I summarize. Based on @pento s comment here :
It sounds like this is the plan for merging into Core:
If I've got that right, here's a few examples to consider: ACF and other Page Builders Most plugins that use Shortcodes Freelancers/Agencies that build CPTs in their sleep Or they need to learn how to create a trimmed down Gutenberg block experience. This is made a bit easier with Gutenberg features like this one, and ideally this one if it gets addressed. But the ideal experience in a post-Gutenberg-merge world is that the Is that the gist @pento ? |
Thanks for the summary, @mathetos. As @danielbachhuber's comment suggests, there are a few inter-related issues. I think a
It's important to note that that the behaviour of falling back to classic would only be guaranteed for WordPress 5.0: a future release will change this behaviour: CPTs that don't explicitly opt out will likely start loading in the block editor, and those that do opt out will potentially show a "you need to install the Classic Editor plugin" message. I would expect CPTs that use Obviously, these changes won't happen without being appropriately announced, but you should be planning on updating your code to support the block editor where you can, and rolling out the Classic Editor plugin where you cannot. We definitely don't want to leave folks with a transition process that they don't understand, or to cut support off prematurely. But it does need to be explicitly clear that everyone will eventually need to transition to either supporting the block editor, or requiring the classic editor. |
@pento Is the Classic Editor plugin going to be updated so that it's more flexible? At the moment it only provides a simple checkbox that basically turns off Gutenberg, or provides an Ideally it would be good to be able to select which post type uses Gutenberg and which doesn't. i.e. Display a separate checkbox for every CPT on the site and also for one Pages and one for Posts. What if someone is happy for their site to use Gutenberg on Posts but want the classic editor on Pages and on their CPT? Having |
@maddisondesigns: No, adding that kind of UI isn't planned for the Classic Editor plugin. I understand that people may want to have more advanced UI control, we can certainly add any filters such a plugin would need to be able to create that. |
@pento Following up on your comment:
Is there anything I can do to help move this forward? I expect a ticket in WordPress Core Trac to introduce the new flag would be needed; then corresponding code to enable Gutenberg for CPTs with the |
@greatislander Let's land a PR here (with corresponding unit tests), and then use it as the basis of the core ticket we open. Ultimately, this won't land in core until WP 5.0 |
@danielbachhuber I'll try to take a look at this soon. |
#8682 is related because it's another implicit expectation of functionality that may or may not be available on non- |
What's the status of this one? |
Haven't had any bandwidth to work on this (I was hoping to). |
https://make.wordpress.org/core/2018/10/30/block-editor-filters/ Plugins can define support for block editor using In WordPress 5.0,
|
Thanks for the discussions. 5.0 is already out and we have alternative ways to declare/disable Gutenberg support. Long-term, all CPT will use the block editor (with its different options, with/without content area, with a frozen template...). I don't think it makes sense to add "block-editor" support key if the block editor is the only editor available in WordPress by default. |
Okay, I'm thinking of a directory-style website, where each entry in the directory is a custom-type post. What is the ideal way to configure the admin-side editor without simply disabling the block-editor? Frankly, I absolutely think it should be optional on custom post types, but maybe I'm missing something. |
Issue Overview
This issue is primarily a Core issue for consideration when Gutenberg gets incorporated into WordPress Core.
Custom Post Types should have to declare Gutenberg Support. Currently the "Gutenberg" link is added by default to all post types. Clicking on that link with a custom post type currently takes the user to an error page saying: "No route was found matching the URL and request method" -- a pretty terrible user experience.
Expected Behavior
The "Gutenberg" link should only appear on post types that have declared support for Gutenberg. If that is not there, then the post type edit screen will be loaded with the now current traditional edit screen.
Possible Solution
Add a new "supports" option when post types are registered, like so:
The default for "supports" should NOT include
'gutenberg'
so that it has to be intentionally declared since most post types that exist today will fail as-is.The text was updated successfully, but these errors were encountered: