File tree Expand file tree Collapse file tree 3 files changed +38
-1
lines changed
Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change 1010 ],
1111 "textdomain" : " stackable-ultimate-gutenberg-blocks" ,
1212 "stk-type" : " special" ,
13- "stk-demo" : " https://wpstackable.com/separator-block/?utm_source=welcome&utm_medium=settings&utm_campaign=view_demo&utm_content=demolink"
13+ "stk-demo" : " https://wpstackable.com/separator-block/?utm_source=welcome&utm_medium=settings&utm_campaign=view_demo&utm_content=demolink" ,
14+ "stk-required-blocks" : [
15+ " stackable/icon-label" ,
16+ " stackable/heading" ,
17+ " stackable/icon"
18+ ],
19+ "stk-substitution-blocks" : [
20+ " stackable/text"
21+ ],
22+ "stk-block-dependency" : " stackable/button-group|button" ,
23+ "stk-available-states" : [ " enabled" , " hidden" ]
1424}
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import save from './save'
1515import schema from './schema'
1616import metadata from './block.json'
1717import example from './example'
18+ import substitute from './substitute'
1819
1920export const settings = {
2021 /**
@@ -66,6 +67,7 @@ export const settings = {
6667 example,
6768 edit,
6869 save,
70+ substitute,
6971
7072 // TODO: Uncomment this if we will allow transformation from other blocks to this block.
7173 // transforms,
Original file line number Diff line number Diff line change 1+ export const substitute = {
2+ from : 'stackable/card' , // The name of the current block
3+ transform : ( oldAttributes , innerBlocks ) => {
4+ return [
5+ 'stackable/columns' , // The name of the new block
6+ { ...oldAttributes } , // Attributes of the new block
7+ // The inner blocks of the new block
8+ [
9+ [
10+ 'stackable/column' ,
11+ {
12+ align : oldAttributes . align ,
13+ hasContainer : true ,
14+ } ,
15+ [
16+ [ 'stackable/image' , { imageUrl : oldAttributes . imageUrl } ] ,
17+ ...innerBlocks ,
18+ ] ,
19+ ] ,
20+ ] ,
21+ ]
22+ } ,
23+ }
24+
25+ export default substitute
You can’t perform that action at this time.
0 commit comments