Skip to content

Commit 00db456

Browse files
added card substitute
1 parent 0fce075 commit 00db456

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/block/card/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import schema from './schema'
1717
import metadata from './block.json'
1818
import example from './example'
1919
import deprecated from './deprecated'
20+
import substitute from './substitute'
2021

2122
/**
2223
* WordPress dependencies
@@ -40,4 +41,5 @@ export const settings = {
4041
variations,
4142
edit,
4243
save,
44+
substitute,
4345
}

src/block/card/substitute.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export const substitute = {
2+
from: 'stackable/card',
3+
variants: [],
4+
to: [ 'stackable/columns' ],
5+
transform: ( oldAttributes, innerBlocks ) => {
6+
return [
7+
'stackable/columns',
8+
{ uniqueId: 'test' },
9+
[
10+
[
11+
'stackable/column',
12+
{
13+
align: oldAttributes.align,
14+
hasContainer: true,
15+
},
16+
[
17+
[ 'stackable/image', { imageUrl: oldAttributes.imageUrl } ],
18+
...innerBlocks,
19+
],
20+
],
21+
],
22+
]
23+
},
24+
}
25+
26+
export default substitute

0 commit comments

Comments
 (0)