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 fallback to old gallery edit and save for existing gallery #28961

Merged
11 changes: 11 additions & 0 deletions lib/experiments-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ function gutenberg_initialize_experiments_settings() {
'id' => 'gutenberg-widgets-in-customizer',
)
);
add_settings_field(
'gutenberg-gallery-refactor',
__( 'Gallery Refactor', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Enable the refactored gallery block', 'gutenberg' ),
'id' => 'gutenberg-gallery-refactor',
)
);
register_setting(
'gutenberg-experiments',
'gutenberg-experiments'
Expand Down
51 changes: 51 additions & 0 deletions packages/block-library/src/gallery/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,57 @@
"name": "core/gallery",
"category": "media",
"attributes": {
"images": {
"type": "array",
"default": [],
"source": "query",
"selector": ".blocks-gallery-item",
"query": {
"url": {
"type": "string",
"source": "attribute",
"selector": "img",
"attribute": "src"
},
"fullUrl": {
"type": "string",
"source": "attribute",
"selector": "img",
"attribute": "data-full-url"
},
"link": {
"type": "string",
"source": "attribute",
"selector": "img",
"attribute": "data-link"
},
"alt": {
"type": "string",
"source": "attribute",
"selector": "img",
"attribute": "alt",
"default": ""
},
"id": {
"type": "string",
"source": "attribute",
"selector": "img",
"attribute": "data-id"
},
"caption": {
"type": "string",
"source": "html",
"selector": ".blocks-gallery-item__caption"
}
}
},
"ids": {
"type": "array",
"items": {
"type": "number"
},
"default": []
},
"imageUploads": {
"type": "array",
"default": [],
Expand Down
5 changes: 3 additions & 2 deletions packages/block-library/src/gallery/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ const v5 = {
},
};

/* Comment out the v6 migration to allow new gallery format to be tested in tandem with existing
const v6 = {
attributes: {
images: {
Expand Down Expand Up @@ -1013,5 +1014,5 @@ const v6 = {
];
},
};

export default [ v6, v5, v4, v3, v2, v1 ];
*/
export default [ v5, v4, v3, v2, v1 ];
Loading