AdvancedFields.js
2 years ago
AttributeHelp.js
2 years ago
BlockAddPrevButton.js
2 years ago
BlockAdvancedValue.js
2 years ago
BlockClassName.js
2 years ago
BlockDefaultValue.js
2 years ago
BlockDescription.js
2 years ago
BlockLabel.js
2 years ago
BlockName.js
2 years ago
BlockPlaceholder.js
2 years ago
BlockPrevButtonLabel.js
2 years ago
BlockRequired.js
2 years ago
BlockVisibility.js
2 years ago
FieldControl.js
2 years ago
FieldSettingsWrapper.js
2 years ago
FieldWrapper.js
2 years ago
GeneralFields.js
2 years ago
SelectVariations.js
2 years ago
ToggleGroupVariations.js
2 years ago
ToolBarDefault.js
2 years ago
ToolBarFields.js
2 years ago
FieldSettingsWrapper.js
43 lines
| 1 | const { |
| 2 | __, |
| 3 | } = wp.i18n; |
| 4 | const { |
| 5 | PanelBody, |
| 6 | } = wp.components; |
| 7 | const { |
| 8 | applyFilters, |
| 9 | } = wp.hooks; |
| 10 | const { |
| 11 | useBlockProps, |
| 12 | } = wp.blockEditor; |
| 13 | |
| 14 | /** |
| 15 | * @param props |
| 16 | * @return {boolean|JSX.Element} |
| 17 | * @constructor |
| 18 | */ |
| 19 | function FieldSettingsWrapper( props ) { |
| 20 | const { |
| 21 | title, |
| 22 | children, |
| 23 | } = props; |
| 24 | |
| 25 | const blockProps = useBlockProps(); |
| 26 | const blockName = blockProps[ 'data-type' ].replace( '/', '-' ); |
| 27 | |
| 28 | const CustomSettings = applyFilters( |
| 29 | `jet.fb.render.settings.${ blockName }`, |
| 30 | null, |
| 31 | ); |
| 32 | |
| 33 | return ( |
| 34 | children || CustomSettings |
| 35 | ) && <PanelBody |
| 36 | title={ title || __( 'Field', 'jet-form-builder' ) } |
| 37 | > |
| 38 | { children } |
| 39 | { CustomSettings } |
| 40 | </PanelBody>; |
| 41 | } |
| 42 | |
| 43 | export default FieldSettingsWrapper; |