Skip to content
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

Migrate patten categories #3892

Conversation

ntsekouras
Copy link

Trac ticket: https://core.trac.wordpress.org/ticket/57532

This PR adds the pattern categories migration in WP_REST_Block_Patterns_Controller.
Related GB PR: WordPress/gutenberg#46144.
Part of the GB PR was merged in this changeset: https://core.trac.wordpress.org/changeset/55098


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

* Unwraps nested blocks for readability.

* Moves the bail out code to the top for increased understanding of its purpose.

* Adds inline comments for readability.

* Performance: switches from `array_key_exists()` to `isset()`.
Why? In this use case, `null` is not a concern. `isset()` is slightly more performant.
Copy link
Contributor

@hellofromtonya hellofromtonya left a comment

Choose a reason for hiding this comment

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

The code matches the changes in GB 46144 and the added test method. LGTM 👍

@hellofromtonya
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants