-
Notifications
You must be signed in to change notification settings - Fork 8
GalleryControl
Junaid Bhura edited this page Jan 5, 2021
·
2 revisions
import { GalleryControl } = gumponents.components;
...
attributes: {
gallery: {
type: 'array',
default: [],
},
},
...
<GalleryControl
size="medium"
onSelect={ ( gallery, media ) => {
setAttributes( { gallery: [] } ); // The block editor doesn't update arrays correctly? 🤷♂️
setAttributes( { gallery } );
} }
value={ attributes.gallery }
/>
The label for the control.
- Type:
String
- Required: No
The help text for the control.
- Type:
String
- Required: No
The label for the select button.
- Type:
String
- Required: No
The label for the remove button.
- Type:
String
- Required: No
The label for the select button when images are already selected.
- Type:
String
- Required: No
The thumbnail size name of the image.
- Type:
String
- Required: No
The value can be either an array of attachment IDs or the original array returned as a value by this control.
- Type:
Array
- Required: Yes
A function that receives the values of the control. This function has two parameters:
- An array of image objects which can be saved as is in the attribute, and can be used in conjunction with the
<Img />
component to build animg
tag. - An array of entire media objects, which can be used for other miscellaneous reasons.
- Type:
Function
- Required: Yes