Skip to content

Conversation

@anton-vlasenko
Copy link
Contributor

@anton-vlasenko anton-vlasenko commented Sep 12, 2022

What?

This PR aims to rename Gutenberg functions that have naming collisions with Core.

Why?

All PHP functions located in the lib/compat folder should use the gutenberg_ prefix.

How?

This PR doesn't modify existing functionality, but can be considered as refactoring.
It renames existing methods to ensure good naming practices.

Testing Instructions

No testing is needed.
This PR refactors existing code.
As an additional precaution, make sure that the unit tests pass.

Screenshots or screencast

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this refactoring 👍

@cbravobernal cbravobernal merged commit 91f6249 into trunk Sep 15, 2022
@cbravobernal cbravobernal deleted the fix/naming-collisions-with-wordpress branch September 15, 2022 08:11
cbravobernal pushed a commit that referenced this pull request Sep 15, 2022
* Rename filter_out_block_nodes to gutenberg_filter_out_block_nodes.
Compatibility code should be prefixed with gutenberg_.

* Deprecate wp_enqueue_block_view_script in Gutenberg as Gutenberg functions should use the gutenberg_ prefix.

* Fix CS.

* Revert the changes back.
Why?
Please see https://github.com/WordPress/gutenberg/blob/trunk/lib/README.md#prefer-the-wp-prefix
@cbravobernal
Copy link
Contributor

Cherry-picked for 14.1

@cbravobernal cbravobernal added [Type] Code Quality Issues or PRs that relate to code quality [Type] Bug An existing feature does not function as intended Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json and removed [Type] Code Quality Issues or PRs that relate to code quality labels Sep 15, 2022
@ockham ockham added the Backport to WP 6.9 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Sep 19, 2022
ockham pushed a commit that referenced this pull request Sep 19, 2022
* Rename filter_out_block_nodes to gutenberg_filter_out_block_nodes.
Compatibility code should be prefixed with gutenberg_.

* Deprecate wp_enqueue_block_view_script in Gutenberg as Gutenberg functions should use the gutenberg_ prefix.

* Fix CS.

* Revert the changes back.
Why?
Please see https://github.com/WordPress/gutenberg/blob/trunk/lib/README.md#prefer-the-wp-prefix
@ockham
Copy link
Contributor

ockham commented Sep 19, 2022

I just cherry-picked this PR to the wp/6.1 branch to get it included in the next release: 34f8b90

@ockham ockham removed the Backport to WP 6.9 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants