-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
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
// Return an entire rule if there is a selector. | ||
if ( $css_selector ) { | ||
$styles_output['css'] = $css_selector . ' { ' . $css . ' }'; | ||
if ( $should_enqueue ) { | ||
$current_css_rule = static::$block_supports_store->get_rule( $css_selector ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 );
}
}
$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']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Testing #42222