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

Add a new endpoint that exposes block editor settings through the REST API #29969

Merged
merged 24 commits into from
May 4, 2021
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
484e3ee
Add a new endpoint that exposes block editor settings through the RES…
Tug Sep 10, 2020
9737fbc
Merge branch 'master' into add/block-editor-settings-rest-endpoint
Feb 25, 2021
0b90f30
Update permission check
Feb 25, 2021
ba80bcc
Global styles - Add check for mobile
Mar 1, 2021
d1cc0f5
Fix lint issues
Mar 1, 2021
1cfd9d1
Merge branch 'trunk' into add/block-editor-settings-rest-endpoint
Mar 15, 2021
052d241
Block editor mobile settings endpoint
Mar 16, 2021
b4205d5
Move theme support data within the if condition
Mar 17, 2021
d332e6e
Add schema
Mar 18, 2021
e3e1c77
Update naming
Mar 18, 2021
2c7abac
Update endpoint name
Mar 22, 2021
ffe9ac1
Use require_once
Mar 22, 2021
6837fa7
Use block editor settings
Mar 25, 2021
d9f3277
Merge branch 'trunk' into add/global-styles-mobile-endpoint
Apr 8, 2021
e18eaa3
Merge branch 'trunk' into add/global-styles-mobile-endpoint
Apr 19, 2021
2328ff6
Usage of get_default_block_editor_settings for the rest api endpoint
Apr 5, 2021
ede0fc1
Block editor settings update schema
Apr 19, 2021
ddb0dcd
Merge branch 'trunk' into add/global-styles-mobile-endpoint
Apr 20, 2021
3a3908f
Add context as a param to get the block editor settings, update permi…
Apr 20, 2021
108debd
Remove unneeded filter
Apr 20, 2021
2d24002
Remove unneeded changes
Apr 20, 2021
ec6fa21
Update context in schema
Apr 21, 2021
f5db2fc
Update context for global styles attributes
Apr 26, 2021
3897d19
Update class-wp-rest-block-editor-settings-controller.php
gziolo May 4, 2021
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
54 changes: 27 additions & 27 deletions lib/class-wp-rest-block-editor-settings-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,163 +101,163 @@ public function get_item_schema() {
'__unstableEnableFullSiteEditingBlocks' => array(
'description' => __( 'Enables Full site editing blocks', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
Copy link
Member

Choose a reason for hiding this comment

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

@youknowriad, see this context which is meant to allow the mobile app to pick settings for a given block editor type. As discussed in #31027 (comment), we need to figure out what those contexts should be.

Copy link
Member

Choose a reason for hiding this comment

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

@draganescu, should it be widget-editor or widgets-editor?

Copy link
Member

Choose a reason for hiding this comment

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

@draganescu, should it be widget-editor or widgets-editor?

@talldan, @noisysocks, @tellthemachines, or @kevin940726 - can you help?

Copy link
Contributor

Choose a reason for hiding this comment

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

widgets-editor seems to be preferred everywhere. Does this match another value defined in the codebase? The name of the editor passed to gutenberg_initialize_editor is currently widgets_editor with an underscore.

There's also the customizer screen, which is widgets_customizer.

Copy link
Member

@gziolo gziolo May 4, 2021

Choose a reason for hiding this comment

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

widgets-editor it is then. I updated the code in 3897d19. Thank you.

There's also the customizer screen, which is widgets_customizer.

Will it use a different set of settings?

),

'styles' => array(
'description' => __( 'Editor styles', 'gutenberg' ),
'type' => 'array',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'supportsTemplateMode' => array(
'description' => __( 'Returns if the current theme is full site editing-enabled or not.', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'supportsLayout' => array(
'description' => __( 'Enable/disable layouts support in container blocks.', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'widgetTypesToHideFromLegacyWidgetBlock' => array(
'description' => __( 'Widget types to hide from legacy widget block.', 'gutenberg' ),
'type' => 'array',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'__experimentalFeatures' => array(
'description' => __( 'Active theme settings and default values.', 'gutenberg' ),
'type' => 'object',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'__experimentalGlobalStylesUserEntityId' => array(
'description' => __( 'Global styles user entity ID.', 'gutenberg' ),
'type' => 'integer',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'__experimentalGlobalStylesBaseStyles' => array(
'description' => __( 'Global styles settings.', 'gutenberg' ),
'type' => 'object',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'alignWide' => array(
'description' => __( 'Enable/Disable Wide/Full Alignments.', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'allowedBlockTypes' => array(
'description' => __( 'Enable/Disable Wide/Full Alignments.', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'allowedMimeTypes' => array(
'description' => __( 'List of allowed mime types and file extensions.', 'gutenberg' ),
'type' => 'object',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'blockCategories' => array(
'description' => __( 'Returns all the categories for block types that will be shown in the block editor.', 'gutenberg' ),
'type' => 'array',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'disableCustomColors' => array(
'description' => __( 'Disables custom colors.', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'disableCustomFontSizes' => array(
'description' => __( 'Disables custom font size.', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'disableCustomGradients' => array(
'description' => __( 'Disables custom font size.', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'enableCustomLineHeight' => array(
'description' => __( 'Enables custom line height.', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'enableCustomSpacing' => array(
'description' => __( 'Enables custom spacing.', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'enableCustomUnits' => array(
'description' => __( 'Enables custom units.', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'isRTL' => array(
'description' => __( 'Determines whether the current locale is right-to-left (RTL).', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'imageDefaultSize' => array(
'description' => __( 'Image default size slug.', 'gutenberg' ),
'type' => 'string',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'imageDimensions' => array(
'description' => __( 'Available image dimensions.', 'gutenberg' ),
'type' => 'object',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'imageEditing' => array(
'description' => __( 'Image Editing settings set to false to disable.', 'gutenberg' ),
'type' => 'boolean',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'imageSizes' => array(
'description' => __( 'Available image sizes.', 'gutenberg' ),
'type' => 'array',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'maxUploadFileSize' => array(
'description' => __( 'Maximum upload size in bytes allowed for the site.', 'gutenberg' ),
'type' => 'number',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'colors' => array(
'description' => __( 'Active theme color palette.', 'gutenberg' ),
'type' => 'array',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'fontSizes' => array(
'description' => __( 'Active theme font sizes.', 'gutenberg' ),
'type' => 'array',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),

'gradients' => array(
'description' => __( 'Active theme gradients.', 'gutenberg' ),
'type' => 'array',
'context' => array( 'view' ),
'context' => array( 'post-editor', 'site-editor', 'widget-editor' ),
),
),
);
Expand Down