Cleanup block editor compatibility logic #580
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First pass as what I was describing earlier. Open for discussion.
Description
No functionality was harmed in the making of this PR.
This is purely development focused, no behavioral changes to the plugin should occur. This same events happen when loading the plugin, the same conditionals are checked, scripts are enqueued the same way and time, etc.
There were three mains reasons for this change:
Modules should have more flexibility around how they integrate with Gutenberg, and being limited to a single unhooking/hooking process is quite restrictive. (metaboxes may also need to be hidden, etc)
The responsibility belongs to the module. The base Edit_Flow class shouldn't need to know about such details. A lot of extra abstractions were removed with the same end result here, though in my opinion it will create a much easier development flow / comprehension.
Gutenberg / Block Support should be a first class citizen moving forward, not shoved away in a corner. I'd prefer to see metaboxes get that treatment in the future 😄
There is more that can be done to clean up how a module reads and the decision tree on whether or not we are loading GB scripts, but I opted to keep this PR as simple as possible with the single purpose of breaking out of the abstraction layers. #565 can take that part further.
There were also quite a bit of unused code/pieces that I removed. Version control has us covered if they are ever needed, though I don't think that will be the case. dde1d2d is the main commit here. And as you can see, we get the same end behavior for much less code, without losing anything.
Steps to Test
Checkout this PR and ensure that the Custom Statuses functionality works the same in Gutenberg as it did before.