Skip to content

Commit

Permalink
Gallery Block: Remove unused attributes property in shortcode transfo…
Browse files Browse the repository at this point in the history
…rmation (WordPress#57356)
  • Loading branch information
t-hamano authored Dec 23, 2023
1 parent f572440 commit 3c7e4ce
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions packages/block-library/src/gallery/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ import {
LINK_DESTINATION_NONE,
LINK_DESTINATION_MEDIA,
} from './constants';
import {
LINK_DESTINATION_ATTACHMENT as DEPRECATED_LINK_DESTINATION_ATTACHMENT,
LINK_DESTINATION_MEDIA as DEPRECATED_LINK_DESTINATION_MEDIA,
} from './v1/constants';
import { pickRelevantMediaFiles, isGalleryV2Enabled } from './shared';

const parseShortcodeIds = ( ids ) => {
Expand Down Expand Up @@ -177,56 +173,6 @@ const transforms = {
{
type: 'shortcode',
tag: 'gallery',

attributes: {
images: {
type: 'array',
shortcode: ( { named: { ids } } ) => {
if ( ! isGalleryV2Enabled() ) {
return parseShortcodeIds( ids ).map( ( id ) => ( {
id: id.toString(),
} ) );
}
},
},
ids: {
type: 'array',
shortcode: ( { named: { ids } } ) => {
if ( ! isGalleryV2Enabled() ) {
return parseShortcodeIds( ids );
}
},
},
columns: {
type: 'number',
shortcode: ( { named: { columns = '3' } } ) => {
return parseInt( columns, 10 );
},
},
linkTo: {
type: 'string',
shortcode: ( { named: { link } } ) => {
if ( ! isGalleryV2Enabled() ) {
switch ( link ) {
case 'post':
return DEPRECATED_LINK_DESTINATION_ATTACHMENT;
case 'file':
return DEPRECATED_LINK_DESTINATION_MEDIA;
default:
return DEPRECATED_LINK_DESTINATION_ATTACHMENT;
}
}
switch ( link ) {
case 'post':
return LINK_DESTINATION_ATTACHMENT;
case 'file':
return LINK_DESTINATION_MEDIA;
default:
return LINK_DESTINATION_NONE;
}
},
},
},
transform( { named: { ids, columns = 3, link } } ) {
const imageIds = parseShortcodeIds( ids ).map( ( id ) =>
parseInt( id, 10 )
Expand Down

0 comments on commit 3c7e4ce

Please sign in to comment.