Adds transform from carousel items list to dynamic items list.
This commit is contained in:
parent
c686e7ce0e
commit
c9e762eefb
|
@ -5,11 +5,13 @@ import icon from './icon.js';
|
||||||
import edit from './edit.js';
|
import edit from './edit.js';
|
||||||
import save from './save.js';
|
import save from './save.js';
|
||||||
import deprecated from './deprecated.js';
|
import deprecated from './deprecated.js';
|
||||||
|
import transforms from './transforms.js';
|
||||||
|
|
||||||
tainacanRegisterBlockType({
|
tainacanRegisterBlockType({
|
||||||
metadata,
|
metadata,
|
||||||
icon,
|
icon,
|
||||||
edit,
|
edit,
|
||||||
save,
|
save,
|
||||||
deprecated
|
deprecated,
|
||||||
|
transforms
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
const { createBlock } = wp.blocks;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
to: [
|
||||||
|
{
|
||||||
|
type: 'block',
|
||||||
|
blocks: [ 'tainacan/dynamic-items-list' ],
|
||||||
|
transform: ( {
|
||||||
|
items,
|
||||||
|
collectionId,
|
||||||
|
searchURL,
|
||||||
|
maxItemsNumber,
|
||||||
|
maxItemsPerScreen,
|
||||||
|
spaceBetweenItems,
|
||||||
|
selectedItems,
|
||||||
|
loadStrategy,
|
||||||
|
hideTitle,
|
||||||
|
cropImagesToSquare,
|
||||||
|
showCollectionHeader,
|
||||||
|
showCollectionLabel,
|
||||||
|
collection,
|
||||||
|
collectionBackgroundColor,
|
||||||
|
collectionTextColor,
|
||||||
|
align,
|
||||||
|
textColor,
|
||||||
|
fontSize
|
||||||
|
} ) => {
|
||||||
|
return createBlock(
|
||||||
|
'tainacan/dynamic-items-list',
|
||||||
|
{
|
||||||
|
items: items,
|
||||||
|
content: [ { type: true } ],
|
||||||
|
collection: collection,
|
||||||
|
collectionId: collectionId,
|
||||||
|
showImage: true,
|
||||||
|
showName: !hideTitle,
|
||||||
|
layout: 'grid',
|
||||||
|
isModalOpen: false,
|
||||||
|
gridMargin: spaceBetweenItems,
|
||||||
|
searchURL: searchURL,
|
||||||
|
itemsRequestSource: '',
|
||||||
|
maxItemsNumber: maxItemsNumber,
|
||||||
|
order: '',
|
||||||
|
searchString: '',
|
||||||
|
selectedItems: selectedItems,
|
||||||
|
isLoading: false,
|
||||||
|
loadStrategy: loadStrategy,
|
||||||
|
showSearchBar: false,
|
||||||
|
showCollectionHeader: showCollectionHeader,
|
||||||
|
showCollectionLabel: showCollectionLabel,
|
||||||
|
isLoadingCollection: false,
|
||||||
|
collectionBackgroundColor: collectionBackgroundColor,
|
||||||
|
collectionTextColor: collectionTextColor,
|
||||||
|
mosaicHeight: 280,
|
||||||
|
mosaicGridColumns: maxItemsPerScreen,
|
||||||
|
mosaicGridRows: 3,
|
||||||
|
mosaicItemFocalPoint: {
|
||||||
|
x: 0.5,
|
||||||
|
y: 0.5
|
||||||
|
},
|
||||||
|
sampleBackgroundImage: '',
|
||||||
|
mosaicDensity: 6,
|
||||||
|
maxColumnsCount: 4,
|
||||||
|
cropImagesToSquare: cropImagesToSquare,
|
||||||
|
align: align,
|
||||||
|
textColor: textColor,
|
||||||
|
fontSize: fontSize
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
Loading…
Reference in New Issue