Style engine:Style Engine Rules & Store objects tests#42408
Closed
Style engine:Style Engine Rules & Store objects tests#42408
Conversation
|
Size Change: 0 B Total Size: 1.25 MB ℹ️ View Unchanged
|
3160b7b to
9915d5d
Compare
ramonjd
commented
Jul 14, 2022
| if ( $css_selector ) { | ||
| $styles_output['css'] = $css_selector . ' { ' . $css . ' }'; | ||
| if ( $should_enqueue ) { | ||
| $current_css_rule = static::$block_supports_store->get_rule( $css_selector ); |
Member
Author
There was a problem hiding this comment.
Here is where it'd be nice to have an explicit set_rule method.
In come cases we want to return a css rule string, e.g.,
$styles_output['css'] = $css_selector . ' { ' . $css . ' }';and not store it.
With a set_rule method we could do the following:
if ( $css_selector ) {
$css_rule = new WP_Style_Engine_CSS_Rule( $css_selector, $css_declarations )
$styles_output['css'] = $css_rule-get_css();
if ( $should_enqueue ) {
$current_css_rule = static::$block_supports_store->get_rule( $css_selector );
$current_css_rule->set_declarations( $css_rule );
}
}
ramonjd
commented
Jul 14, 2022
| $css_selector = isset( $options['selector'] ) ? $options['selector'] : null; | ||
| $style_rules = new WP_Style_Engine_CSS_Declarations( $css_declarations ); | ||
| $css_selector = isset( $options['selector'] ) ? $options['selector'] : null; | ||
| $should_enqueue = isset( $options['enqueue'] ) && true === $options['enqueue']; |
Member
Author
There was a problem hiding this comment.
We should create another public method, e.g., wp_style_engine_enqueue_block_supports_styles to hide this implementation.
This is just testing for now.
bc36dbe to
774399d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Testing #42222