PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.15.5
GiveWP – Donation Plugin and Fundraising Platform v4.15.5
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / EventTickets / resources / blocks / EventTicketsBlock / Edit / BlockInspectorControls.tsx

BlockInspectorControls.tsx in GiveWP – Donation Plugin and Fundraising Platform 4.15.5, at src/EventTickets/resources/blocks/EventTicketsBlock/Edit/BlockInspectorControls.tsx

44 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import {InspectorControls} from '@wordpress/block-editor';
2 import {PanelBody, PanelRow, SelectControl} from '@wordpress/components';
3 import {createInterpolateElement} from '@wordpress/element';
4 import {__} from '@wordpress/i18n';
5 import CreateEventNotice from './components/CreateEventNotice';
6
7 /**
8 * @since 3.6.0
9 */
10 export default function BlockInspectorControls({attributes, setAttributes}) {
11 const {events} = window.eventTicketsBlockSettings;
12 const {eventId} = attributes;
13
14 const eventOptions =
15 events.map((event) => {
16 return {label: event.title, value: `${event.id}`};
17 }) ?? [];
18
19 return (
20 <InspectorControls>
21 <PanelBody title={__('Event', 'give')} initialOpen={true}>
22 {events.length === 0 ? (
23 <CreateEventNotice />
24 ) : (
25 <PanelRow>
26 <SelectControl
27 label={__('Event Name', 'give')}
28 help={createInterpolateElement(
29 __('Add or edit an event in the <a>events page</a>.', 'give'),
30 {
31 a: <a href={window.eventTicketsBlockSettings.listEventsUrl} target="_blank" />,
32 }
33 )}
34 value={`${eventId}`}
35 options={[{label: 'Select', value: ''}, ...eventOptions]}
36 onChange={(value: string) => setAttributes({eventId: Number(value)})}
37 />
38 </PanelRow>
39 )}
40 </PanelBody>
41 </InspectorControls>
42 );
43 }
44