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

REST API: Fix hacky block editor settings filter #64743

Merged
merged 1 commit into from
Aug 24, 2024

Conversation

swissspidy
Copy link
Member

What?

Fix gutenberg_get_block_editor_settings_mobile and WP_REST_Block_Editor_Settings_Controller to not rely on constants and superglobals.

Why?

I wanted to work on some PHP stuff in another PR and realized that this hacky code breaks a lot of things because of side effects like defining REST_REQUEST in a test file (not even within the class and in a separate process!)

How?

Refactor these two places to not rely on $_GET['context'] or defined( 'REST_REQUEST' ) and do things the proper way.

Testing Instructions

Block editor settings for mobile should still work the same.

Testing Instructions for Keyboard

N/A

Screenshots or screencast

N/A

@swissspidy swissspidy added [Type] Bug An existing feature does not function as intended REST API Interaction Related to REST API Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) labels Aug 23, 2024
Copy link

github-actions bot commented Aug 23, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: swissspidy <swissspidy@git.wordpress.org>
Co-authored-by: spacedmonkey <spacedmonkey@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@swissspidy swissspidy merged commit f42d775 into trunk Aug 24, 2024
62 checks passed
@swissspidy swissspidy deleted the fix/hacky-rest-api-code branch August 24, 2024 20:48
@github-actions github-actions bot added this to the Gutenberg 19.2 milestone Aug 24, 2024
bph pushed a commit to bph/gutenberg that referenced this pull request Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) REST API Interaction Related to REST API [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants