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

Specify what settings can be part of settings.layout #33303

Merged
merged 2 commits into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ class WP_Theme_JSON_Gutenberg {
'palette' => null,
),
'custom' => null,
'layout' => null,
'layout' => array(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think later we'll have "type" and a different shape of layout depending of the "type". Maybe it's fine for now to have this but I thought I'd mention in case it's any impactful.

Copy link
Member Author

@oandregal oandregal Jul 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When/If we have those new fields we can add them all and/or have some specific logic for layout to make sure only the ones that make sense depending on type are allowed.

By porting this to WordPress core we won't allow anything else than what it's shipped in v1 (the two fields in use atm) without the plugin. With the plugin, consumers will have those new things available. Makes sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WFM 👍

'contentSize' => null,
'wideSize' => null,
),
'spacing' => array(
'customMargin' => null,
'customPadding' => null,
Expand Down
7 changes: 7 additions & 0 deletions phpunit/class-wp-theme-json-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ function test_get_settings() {
'color' => array(
'custom' => false,
),
'layout' => array(
'contentSize' => 'value',
'invalid/key' => 'value',
),
'invalid/key' => 'value',
'blocks' => array(
'core/group' => array(
Expand Down Expand Up @@ -44,6 +48,9 @@ function test_get_settings() {
'color' => array(
'custom' => false,
),
'layout' => array(
'contentSize' => 'value',
),
'blocks' => array(
'core/group' => array(
'color' => array(
Expand Down