Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
09a7d05
Add support for individual side borders via BorderBoxControl
aaronrobertshaw Feb 1, 2022
136e6af
Tweak table styles to be less ugly with split borders
aaronrobertshaw Feb 1, 2022
9b026e7
Update Search block for individual border support
aaronrobertshaw Feb 3, 2022
7ed686c
Extend theme.json class to support individual borders
aaronrobertshaw Mar 23, 2022
45f6393
Update positioning of border control popovers
aaronrobertshaw Mar 25, 2022
344314a
Update border related properties in theme.json schema
aaronrobertshaw Apr 1, 2022
6fdef6f
Update living theme.json md file
aaronrobertshaw Apr 1, 2022
5ec71d4
Keep linter happy
aaronrobertshaw Apr 1, 2022
8672d6a
Fix border skip serialization checks
aaronrobertshaw Apr 1, 2022
eb92cbf
Fix typos
aaronrobertshaw Apr 4, 2022
301f755
Only implode classes and styles in primary application function
aaronrobertshaw Apr 4, 2022
e3266b6
Remove unneeded border radius control class
aaronrobertshaw Apr 4, 2022
0b828e4
Improve comment punctuation
aaronrobertshaw Apr 4, 2022
ec3ffb9
Prevent empty sideBorderColors object for split borders
aaronrobertshaw Apr 4, 2022
649f51e
Add explanatory comment
aaronrobertshaw Apr 4, 2022
ad51e60
Enable alpha colors for borders
aaronrobertshaw Apr 4, 2022
b43ba59
Fix whitespace typo
aaronrobertshaw Apr 7, 2022
516d819
Switch to preset approach for named colors
aaronrobertshaw Apr 8, 2022
2c8fcca
Fix linting errors
aaronrobertshaw Apr 8, 2022
5e700d1
Clean up split border style generation
aaronrobertshaw Apr 8, 2022
4c1d414
Take info from style.border.side.color value instead of colorSlug
oandregal Apr 8, 2022
5f74e1b
Take info from style.border.side.color value instead of colorSlug (cl…
oandregal Apr 8, 2022
06de976
Take info from style.border.side.color (search block)
oandregal Apr 8, 2022
f260382
Fix PHP lint issues
oandregal Apr 8, 2022
461717d
Remove obsolete colorSlug attributes from border test
aaronrobertshaw Apr 12, 2022
84f4f4b
Prevent editor forced shorthand styles applying incorrect styles
aaronrobertshaw Apr 13, 2022
ea485d5
Make skip serialization check consistent
aaronrobertshaw Apr 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up split border style generation
  • Loading branch information
aaronrobertshaw committed Apr 13, 2022
commit 5e700d160c2f2628fd72aee5e82b05f452915ce6
25 changes: 7 additions & 18 deletions lib/block-supports/border.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,8 @@ function gutenberg_apply_border_support( $block_type, $block_attributes ) {
$border = _wp_array_get( $block_attributes, array( 'style', 'border', $side ), false );

if ( is_array( $border ) && ! empty( $border ) ) {
$split_border_attributes = gutenberg_generate_individual_border_classes_and_styles( $side, $border, $block_type );

if ( $split_border_attributes['classes'] ) {
$classes = array_merge( $classes, $split_border_attributes['classes'] );
}

if ( $split_border_attributes['styles'] ) {
$styles = array_merge( $styles, $split_border_attributes['styles'] );
}
$split_border_styles = gutenberg_generate_individual_border_classes_and_styles( $side, $border, $block_type );
$styles = array_merge( $styles, $split_border_styles );
}
}
}
Expand All @@ -160,21 +153,20 @@ function gutenberg_apply_border_support( $block_type, $block_attributes ) {
}

/**
* Generates CSS classes and longhand CSS styles for an individual side border.
* Generates longhand CSS styles for an individual side border.
*
* If some values are omitted from the border configuration, using shorthand
* styles would lead to `initial` values being used instead of the more
* desirable inherited values. This could also lead to browser inconsistencies.
*
* @param string $side The side the classes and styles are being generated for.
* @param string $side The side the styles are being generated for.
* @param array $border Array containing border color, style, and width values.
* @param WP_Block_Type $block_type Block type.
*
* @return array CSS classes and longhand border styles for a single side.
* @return array Longhand CSS border styles for a single side.
*/
function gutenberg_generate_individual_border_classes_and_styles( $side, $border, $block_type ) {
$classes = array();
$styles = array();
$styles = array();

if (
isset( $border['width'] ) &&
Expand Down Expand Up @@ -207,10 +199,7 @@ function gutenberg_generate_individual_border_classes_and_styles( $side, $border
}
}

return array(
'classes' => $classes,
'styles' => $styles,
);
return $styles;
}

/**
Expand Down