PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 4.0.3
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v4.0.3
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
profile-builder / form-builder / blocks / src / blocks / field-turnstile / edit.js

edit.js in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 4.0.3, at form-builder/blocks/src/blocks/field-turnstile/edit.js

79 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from '@wordpress/i18n';
2 import { PanelBody, TextControl, SelectControl, CheckboxControl, BaseControl } from '@wordpress/components';
3 import BaseFieldEdit from '../../components/BaseFieldEdit';
4 import { toggleInCsv, csvIncludes } from '../../components/csv';
5
6 const PB_FORMS = [
7 { value: 'pb_login', label: __( 'PB Login', 'profile-builder' ) },
8 { value: 'pb_register', label: __( 'PB Register', 'profile-builder' ) },
9 { value: 'pb_recover_password', label: __( 'PB Recover Password', 'profile-builder' ) },
10 ];
11
12 const WP_FORMS = [
13 { value: 'default_wp_login', label: __( 'Default WP Login', 'profile-builder' ) },
14 { value: 'default_wp_register', label: __( 'Default WP Register', 'profile-builder' ) },
15 { value: 'default_wp_recover_password', label: __( 'Default WP Recover Password', 'profile-builder' ) },
16 ];
17
18 export default function Edit( props ) {
19 const { attributes, setAttributes } = props;
20
21 const extraPanels = (
22 <PanelBody title={ __( 'Turnstile Settings', 'profile-builder' ) }>
23 <SelectControl
24 label={ __( 'Turnstile Theme', 'profile-builder' ) }
25 value={ attributes[ 'theme' ] }
26 options={ [
27 { label: __( 'Auto', 'profile-builder' ), value: 'auto' },
28 { label: __( 'Light', 'profile-builder' ), value: 'light' },
29 { label: __( 'Dark', 'profile-builder' ), value: 'dark' },
30 ] }
31 onChange={ ( val ) => setAttributes( { 'theme': val } ) }
32 />
33 <TextControl
34 label={ __( 'Site Key', 'profile-builder' ) }
35 value={ attributes[ 'turnstile-site-key' ] }
36 onChange={ ( val ) => setAttributes( { 'turnstile-site-key': val } ) }
37 />
38 <TextControl
39 label={ __( 'Secret Key', 'profile-builder' ) }
40 value={ attributes[ 'turnstile-secret-key' ] }
41 onChange={ ( val ) => setAttributes( { 'turnstile-secret-key': val } ) }
42 />
43 <BaseControl label={ __( 'Display on PB forms', 'profile-builder' ) }>
44 { PB_FORMS.map( ( opt ) => (
45 <CheckboxControl
46 key={ opt.value }
47 label={ opt.label }
48 checked={ csvIncludes( attributes[ 'turnstile-pb-forms' ], opt.value ) }
49 onChange={ ( checked ) =>
50 setAttributes( { 'turnstile-pb-forms': toggleInCsv( attributes[ 'turnstile-pb-forms' ], opt.value, checked ) } )
51 }
52 />
53 ) ) }
54 </BaseControl>
55 <BaseControl label={ __( 'Display on default WP forms', 'profile-builder' ) }>
56 { WP_FORMS.map( ( opt ) => (
57 <CheckboxControl
58 key={ opt.value }
59 label={ opt.label }
60 checked={ csvIncludes( attributes[ 'turnstile-wp-forms' ], opt.value ) }
61 onChange={ ( checked ) =>
62 setAttributes( { 'turnstile-wp-forms': toggleInCsv( attributes[ 'turnstile-wp-forms' ], opt.value, checked ) } )
63 }
64 />
65 ) ) }
66 </BaseControl>
67 </PanelBody>
68 );
69
70 return (
71 <BaseFieldEdit { ...props } inspectorPanels={ extraPanels }>
72 <div style={ { padding: '10px', border: '1px dashed #ccc', backgroundColor: '#fafafa', color: '#666', fontSize: '12px' } }>
73 <span className="dashicons dashicons-shield" style={ { marginRight: '5px' } } />
74 { __( 'Cloudflare Turnstile Placeholder', 'profile-builder' ) }
75 </div>
76 </BaseFieldEdit>
77 );
78 }
79