diff --git a/docs/how-to-guides/themes/theme-json.md b/docs/how-to-guides/themes/theme-json.md index 2212f98a1c870..697592adf3236 100644 --- a/docs/how-to-guides/themes/theme-json.md +++ b/docs/how-to-guides/themes/theme-json.md @@ -343,6 +343,7 @@ To retain backward compatibility, the existing `add_theme_support` declarations | `editor-font-sizes` | Provide the list of font size via `typography.fontSizes`. | | `editor-gradient-presets` | Provide the list of gradients via `color.gradients`. | | `appearance-tools` | Set `appearanceTools` to `true`. | +| `border` | Set `border: color, radius, style, width` to `true`. | | `link-color ` | Set `color.link` to `true`. | #### Presets diff --git a/docs/how-to-guides/themes/theme-support.md b/docs/how-to-guides/themes/theme-support.md index 45402691795cd..eae72f255fac2 100644 --- a/docs/how-to-guides/themes/theme-support.md +++ b/docs/how-to-guides/themes/theme-support.md @@ -477,6 +477,14 @@ Use this setting to enable the following Global Styles settings: add_theme_support( 'appearance-tools' ); ``` +## Border + +Use this to enable all border settings: + +```php +add_theme_support( 'border' ); +``` + ## Link color Use this to enable the link color setting: diff --git a/lib/class-wp-theme-json-resolver-gutenberg.php b/lib/class-wp-theme-json-resolver-gutenberg.php index 73cae004bfbad..6e9d05cd7f238 100644 --- a/lib/class-wp-theme-json-resolver-gutenberg.php +++ b/lib/class-wp-theme-json-resolver-gutenberg.php @@ -319,6 +319,14 @@ public static function get_theme_data( $deprecated = array(), $options = array() // Classic themes without a theme.json don't support global duotone. $theme_support_data['settings']['color']['defaultDuotone'] = false; + // Allow themes to enable all border settings via theme_support. + if ( current_theme_supports( 'border' ) ) { + $theme_support_data['settings']['border']['color'] = true; + $theme_support_data['settings']['border']['radius'] = true; + $theme_support_data['settings']['border']['style'] = true; + $theme_support_data['settings']['border']['width'] = true; + } + // Allow themes to enable link colors via theme_support. if ( current_theme_supports( 'link-color' ) ) { $theme_support_data['settings']['color']['link'] = true; diff --git a/packages/core-data/src/entity-types/theme.ts b/packages/core-data/src/entity-types/theme.ts index 6e15738dd992e..761c6461d4aca 100644 --- a/packages/core-data/src/entity-types/theme.ts +++ b/packages/core-data/src/entity-types/theme.ts @@ -85,6 +85,10 @@ declare module './base-entity-records' { * Whether posts and comments RSS feed links are added to head. */ 'automatic-feed-links': boolean; + /** + * Whether border settings are enabled. + */ + border: boolean; /** * Custom background if defined by the theme. */