Style engine: rename global function #42719
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.
What?
Rename
wp_style_engine_get_block_supports_styles
towp_style_engine_get_styles
and document a 'context' option that will determine how we treat incoming style object.Why?
We'll potentially have multiple origins of styles, even though those style object will be similar. For example, the value of a block's attributes.style object or the top level styles in theme.json.
To avoid having multiple, specifically-named global functions, why not one that can handle everything?
Better for future compatibility, flexibility and better for our brains!
Props to @aristath for the idea.
How?
Renaming.
Testing Instructions
Run
npm test-unit-php
Smoke test a site to ensure nothing breaks.