Skip to content

Commit

Permalink
Add border theme_support (WordPress#51777)
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinan authored and sethrubenstein committed Jul 13, 2023
1 parent 1f0c696 commit 44191ec
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/how-to-guides/themes/theme-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions docs/how-to-guides/themes/theme-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions lib/class-wp-theme-json-resolver-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions packages/core-data/src/entity-types/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 44191ec

Please sign in to comment.