Skip to content
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

Enable appearance tools via theme_support #43337

Merged
merged 6 commits into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
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 @@ -325,6 +325,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`. |
| `experimental-link-color` | Set `color.link` to `true`. `experimental-link-color` will be removed when the plugin requires WordPress 5.9 as the minimum version. |
| `appearance-tools` | Set `appearanceTools` to `true`. |

#### Presets

Expand Down
13 changes: 13 additions & 0 deletions docs/how-to-guides/themes/theme-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,3 +463,16 @@ where
- `<link-color>` is either `var(--wp--preset--color--slug)` (if the user selected a preset value) or a raw color value (if the user selected a custom value)

The block will get attached the class `.wp-elements-<uuid>`.

## Appearance Tools

Use this setting to enable the following Global Styles settings:

- border: color, radius, style, width
- color: link
- spacing: blockGap, margin, padding
- typography: lineHeight

```php
add_theme_support( 'appearance-tools' );
```
5 changes: 5 additions & 0 deletions lib/experimental/class-wp-theme-json-resolver-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ public static function get_theme_data( $deprecated = array(), $settings = array(

// Classic themes without a theme.json don't support global duotone.
$theme_support_data['settings']['color']['defaultDuotone'] = false;

// Allow themes to enable appearance tools via theme_support.
if ( current_theme_supports( 'appearance-tools' ) ) {
$theme_support_data['settings']['appearanceTools'] = true;
}
}
$with_theme_supports = new WP_Theme_JSON_Gutenberg( $theme_support_data );
$with_theme_supports->merge( static::$theme );
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 @@ -78,6 +78,10 @@ declare module './base-entity-records' {
* Whether theme opts in to wide alignment CSS class.
*/
'align-wide': boolean;
/**
* Wether appearanceTools are enabled in Global Styles
pbking marked this conversation as resolved.
Show resolved Hide resolved
*/
'appearance-tools': boolean;
/**
* Whether posts and comments RSS feed links are added to head.
*/
Expand Down