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

Image block: Revise lightbox UI to remove 'behaviors' #53851

Merged
merged 20 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
08bb1ed
Begin removing theme.json dependency in block UI
artemiomorales Aug 21, 2023
c93f1b6
Remove the useHasBehaviorsPanel hook
michalczaplinski Aug 21, 2023
25aa1c6
Fix declaration to actually retrieve from user data
artemiomorales Aug 21, 2023
a8c09c9
Restructured use of global behaviors
michalczaplinski Aug 21, 2023
fac2e3a
More removal of behaviors.
michalczaplinski Aug 28, 2023
dfc1c46
Remove the reference to behaviors in Global styles and first iteratio…
michalczaplinski Aug 28, 2023
51e4802
Remove behaviors altogether and everywhere
michalczaplinski Aug 29, 2023
b416558
Fix linter & sniffer PHP errors
michalczaplinski Aug 30, 2023
321a213
Adjust schema properties count assertion
michalczaplinski Aug 30, 2023
0021116
Add the lightbox attribute
michalczaplinski Aug 30, 2023
6951a86
Remove unnecessary space
michalczaplinski Aug 30, 2023
92b084f
Merge branch 'trunk' into update/revise-lightbox-ui
michalczaplinski Sep 6, 2023
232161a
Add clarifying comment regarding skipped tests
artemiomorales Sep 7, 2023
cabe31b
Do not remove `behaviors` attribute from Image block's block.json.
michalczaplinski Sep 7, 2023
aa4450e
Revert "Do not remove `behaviors` attribute from Image block's block.…
michalczaplinski Sep 7, 2023
91b86ef
Merge branch 'trunk' into update/revise-lightbox-ui
michalczaplinski Sep 11, 2023
f9e48f4
Revert deletion of behaviors.php
artemiomorales Sep 11, 2023
8b95f4a
Merge branch 'trunk' into update/revise-lightbox-ui
michalczaplinski Sep 14, 2023
1b3a480
Image block: UI updates for the image lightbox (#54071)
artemiomorales Sep 15, 2023
ef8c396
Revert "Image block: UI updates for the image lightbox (#54071)"
artemiomorales Sep 15, 2023
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
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ Insert an image to make a visual statement. ([Source](https://github.com/WordPre

- **Name:** core/image
- **Category:** media
- **Supports:** anchor, behaviors (lightbox), color (~~background~~, ~~text~~), filter (duotone)
- **Supports:** anchor, color (~~background~~, ~~text~~), filter (duotone)
- **Attributes:** align, alt, aspectRatio, caption, height, href, id, linkClass, linkDestination, linkTarget, rel, scale, sizeSlug, title, url, width

## Latest Comments
Expand Down
10 changes: 0 additions & 10 deletions docs/reference-guides/theme-json-reference/theme-json-living.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,6 @@ Settings related to typography.
Generate custom CSS custom properties of the form `--wp--custom--{key}--{nested-key}: {value};`. `camelCased` keys are transformed to `kebab-case` as to follow the CSS property naming schema. Keys at different depth levels are separated by `--`, so keys should not include `--` in the name.


---

### behaviors

Settings related to behaviors.

| Property | Type | Default | Props |
| --- | --- | --- |--- |
| lightbox | boolean | false | |

---
## Styles

Expand Down
243 changes: 0 additions & 243 deletions lib/block-supports/behaviors.php

This file was deleted.

33 changes: 5 additions & 28 deletions lib/class-wp-rest-global-styles-controller-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ public function update_item( $request ) {
*
* @since 5.9.0
* @since 6.2.0 Added validation of styles.css property.
* @since 6.4.0 Added validation of behaviors property.
*
* @param WP_REST_Request $request Request object.
* @return stdClass|WP_Error Prepared item on success. WP_Error on when the custom CSS is not valid.
Expand All @@ -322,7 +321,7 @@ protected function prepare_item_for_database( $request ) {
}
}

if ( isset( $request['styles'] ) || isset( $request['settings'] ) || isset( $request['behaviors'] ) ) {
if ( isset( $request['styles'] ) || isset( $request['settings'] ) ) {
$config = array();
if ( isset( $request['styles'] ) ) {
if ( isset( $request['styles']['css'] ) ) {
Expand All @@ -340,11 +339,6 @@ protected function prepare_item_for_database( $request ) {
} elseif ( isset( $existing_config['settings'] ) ) {
$config['settings'] = $existing_config['settings'];
}
if ( isset( $request['behaviors'] ) ) {
$config['behaviors'] = $request['behaviors'];
} elseif ( isset( $existing_config['behaviors'] ) ) {
$config['behaviors'] = $existing_config['behaviors'];
}
$config['isGlobalStylesUserThemeJSON'] = true;
$config['version'] = WP_Theme_JSON_Gutenberg::LATEST_SCHEMA;
$changes->post_content = wp_json_encode( $config );
Expand All @@ -367,7 +361,6 @@ protected function prepare_item_for_database( $request ) {
*
* @since 5.9.0
* @since 6.2.0 Handling of style.css was added to WP_Theme_JSON.
* @since 6.4.0 Added `behavior` field.
*
* @param WP_Post $post Global Styles post object.
* @param WP_REST_Request $request Request object.
Expand Down Expand Up @@ -411,10 +404,6 @@ public function prepare_item_for_response( $post, $request ) { // phpcs:ignore V
$data['styles'] = ! empty( $config['styles'] ) && $is_global_styles_user_theme_json ? $config['styles'] : new stdClass();
}

if ( rest_is_field_included( 'behaviors', $fields ) ) {
$data['behaviors'] = ! empty( $config['behaviors'] ) && $is_global_styles_user_theme_json ? $config['behaviors'] : new stdClass();
}

$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
$data = $this->add_additional_fields_to_object( $data, $request );
$data = $this->filter_response_by_context( $data, $context );
Expand Down Expand Up @@ -521,7 +510,6 @@ public function get_collection_params() {
* Retrieves the global styles type' schema, conforming to JSON Schema.
*
* @since 5.9.0
* @since 6.4.0 Added `behaviors` property.
*
* @return array Item schema data.
*/
Expand All @@ -535,28 +523,23 @@ public function get_item_schema() {
'title' => $this->post_type,
'type' => 'object',
'properties' => array(
'id' => array(
'id' => array(
'description' => __( 'ID of global styles config.', 'gutenberg' ),
'type' => 'string',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
),
'styles' => array(
'styles' => array(
'description' => __( 'Global styles.', 'gutenberg' ),
'type' => array( 'object' ),
'context' => array( 'view', 'edit' ),
),
'settings' => array(
'settings' => array(
'description' => __( 'Global settings.', 'gutenberg' ),
'type' => array( 'object' ),
'context' => array( 'view', 'edit' ),
),
'behaviors' => array(
'description' => __( 'Global behaviors.', 'default' ),
'type' => array( 'object' ),
'context' => array( 'view', 'edit' ),
),
'title' => array(
'title' => array(
'description' => __( 'Title of the global styles variation.', 'gutenberg' ),
'type' => array( 'object', 'string' ),
'default' => '',
Expand Down Expand Up @@ -614,7 +597,6 @@ public function get_theme_item_permissions_check( $request ) { // phpcs:ignore V
* Returns the given theme global styles config.
*
* @since 5.9.0
* @since 6.4.0 Added value for `behaviors` rest field.
*
* @param WP_REST_Request $request The request instance.
* @return WP_REST_Response|WP_Error
Expand Down Expand Up @@ -642,11 +624,6 @@ public function get_theme_item( $request ) {
$data['styles'] = isset( $raw_data['styles'] ) ? $raw_data['styles'] : array();
}

if ( rest_is_field_included( 'behaviors', $fields ) ) {
$raw_data = $theme->get_raw_data();
$data['behaviors'] = isset( $raw_data['behaviors'] ) ? $raw_data['behaviors'] : array();
}

$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
$data = $this->add_additional_fields_to_object( $data, $request );
$data = $this->filter_response_by_context( $data, $context );
Expand Down
2 changes: 0 additions & 2 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ class WP_Theme_JSON_Gutenberg {
'templateParts',
'title',
'version',
'behaviors',
);

/**
Expand Down Expand Up @@ -416,7 +415,6 @@ class WP_Theme_JSON_Gutenberg {
'textTransform' => null,
'writingMode' => null,
),
'behaviors' => null,
);

/**
Expand Down
Loading
Loading