FieldSettings.js
2 years ago
FooterControls.js
2 years ago
HeaderControls.js
2 years ago
edit.js
2 years ago
index.js
2 years ago
preview.js
2 years ago
FooterControls.js
51 lines
| 1 | const { __ } = wp.i18n; |
| 2 | |
| 3 | const { |
| 4 | TextControl, |
| 5 | withFilters, |
| 6 | } = wp.components; |
| 7 | |
| 8 | let FooterControls = function ( { attributes, setAttributes } ) { |
| 9 | return <> |
| 10 | { [ 'post_meta', 'user_meta' ].includes( attributes.field_value ) && |
| 11 | <TextControl |
| 12 | key="hidden_value_field" |
| 13 | label="Meta Field to Get Value From" |
| 14 | value={ attributes.hidden_value_field } |
| 15 | onChange={ hidden_value_field => setAttributes( |
| 16 | { hidden_value_field } ) } |
| 17 | /> } |
| 18 | { 'query_var' === attributes.field_value && <TextControl |
| 19 | key="query_var_key" |
| 20 | label="Query Variable Key" |
| 21 | value={ attributes.query_var_key } |
| 22 | onChange={ query_var_key => setAttributes( { query_var_key } ) } |
| 23 | /> } |
| 24 | { 'current_date' === attributes.field_value && <> |
| 25 | <TextControl |
| 26 | key="date_format" |
| 27 | label="Format" |
| 28 | value={ attributes.date_format } |
| 29 | onChange={ date_format => setAttributes( { date_format } ) } |
| 30 | /> |
| 31 | <b>{ __( 'Example:', 'jet-form-builder' ) }</b><br/> |
| 32 | <i>Y-m-d\TH:i - </i>{ __( 'datetime format', |
| 33 | 'jet-form-builder' ) }<br/> |
| 34 | <i>U - </i>{ __( 'timestamp format', 'jet-form-builder' ) } |
| 35 | </> } |
| 36 | { 'manual_input' === attributes.field_value && <TextControl |
| 37 | key="hidden_value" |
| 38 | label="Value" |
| 39 | value={ attributes.hidden_value } |
| 40 | onChange={ newValue => { |
| 41 | setAttributes( { hidden_value: newValue } ); |
| 42 | } } |
| 43 | /> } |
| 44 | </>; |
| 45 | }; |
| 46 | |
| 47 | FooterControls = withFilters( |
| 48 | 'jfb.hidden-field.field-value.controls', |
| 49 | )( FooterControls ); |
| 50 | |
| 51 | export default FooterControls; |