[wp-trac] [WordPress Trac] #53610: Remove references to Gutenberg specific functions
WordPress Trac
noreply at wordpress.org
Wed Jul 7 00:47:09 UTC 2021
#53610: Remove references to Gutenberg specific functions
--------------------------+---------------------
Reporter: desrosj | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.8
Component: Editor | Version:
Severity: normal | Resolution:
Keywords: dev-feedback | Focuses:
--------------------------+---------------------
Comment (by noisysocks):
Yes, like others have pointed out, this bit of PHP is copied from the
Gutenberg plugin when `grunt build --dev` is run. We can't remove the
references to `gutenberg_` functions from the PHP code in the Gutenberg
plugin because the Gutenberg plugin needs to support previous versions of
WordPress.
> Right, unfortunately. BTW why are there PHP files in the JS packages in
npm? Sounds... somewhat not right (I agree that's another discussion, will
open a ticket/issue).
> The most straightforward way to fix this seems to be to "decouple" wp-
includes/blocks/legacy-widget.php and stop updating it from npm. Should
also be removed from the package, but that's a discussion for the
Gutenberg repo.
A block's JavaScript and CSS is highly dependent on any PHP that the block
has. I'd argue that coupling them is the correct thing to do. But, yes,
like you say, that's a discussion for another time :)
I don't think we should make an exception for only `legacy-widget.php`.
Right now, **all** blocks have their PHP copied from Gutenberg. Let's be
consistent.
> If the intent is to keep Gutenberg working as a plugin "decoupling"
seems to be the best way forward for all PHP files, not just this one.
Also, it should follow the basic rule for WP plugins: always prefix all
names! :)
Gutenberg will prefix any function name in the block's PHP when running as
a plugin. The prefix is removed when packaged to npm for use in Core.
----
Personally I think that there is no issue here. There is no user-facing
bug and the core PHP code which references `gutenberg_` functions will
never run.
It's potentially confusing to developers who are reading `wp-
includes/blocks/legacy-widget.php` to see a `gutenberg_` prefix in the
source code, but this will be removed once the Gutenberg plugin requires
WordPress 5.8 as its minimum version. We should potentially also look into
making it clearer that these files are auto-generated by including a
comment at the top of the file.
So, I'd close this ticket as `wontfix`. But happy to defer to the group :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53610#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list