Skip to content

Commit

Permalink
Refator CSS build function to be more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave authored and draganescu committed Jun 6, 2022
1 parent 0281d5f commit 9ee5def
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/block-supports/elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ function gutenberg_get_elements_class_name( $block ) {
return 'wp-elements-' . md5( serialize( $block ) );
}



/**
* Update the block content with elements class names.
*
Expand All @@ -29,9 +31,9 @@ function gutenberg_render_elements_support( $block_content, $block ) {

$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
$skip_link_color_serialization = gutenberg_should_skip_block_supports_serialization( $block_type, 'color', 'link' );
$skip_link_color_serialization = gutenberg_should_skip_block_supports_serialization( $block_type, 'color', 'link:hover' );
$skip_link_hover_color_serialization = gutenberg_should_skip_block_supports_serialization( $block_type, 'color', 'link:hover' );

if ( $skip_link_color_serialization && $skip_link_color_serialization ) {
if ( $skip_link_color_serialization && $skip_link_hover_color_serialization ) {
return $block_content;
}

Expand Down Expand Up @@ -100,6 +102,7 @@ function gutenberg_render_elements_support_styles( $pre_render, $block ) {
$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
$element_block_styles = isset( $block['attrs']['style']['elements'] ) ? $block['attrs']['style']['elements'] : null;


/*
* For now we only care about link color and link hover color.
* This code in the future when we have a public API
Expand Down

0 comments on commit 9ee5def

Please sign in to comment.