| 1 |
/** |
| 2 |
* Inspector panel for the Edit Profile Approved by Admin add-on. |
| 3 |
* |
| 4 |
* Edits one attribute injected by the EPAA bridge: |
| 5 |
* - edit-profile-approved-by-admin (string scalar: '' | 'yes') |
| 6 |
* |
| 7 |
* Storage shape matches the legacy classic-admin checkbox in |
| 8 |
* `wppb_in_epaa_properties_manage_field()`: the property is set to the literal |
| 9 |
* string 'yes' when enabled, and absent or empty otherwise. |
| 10 |
*/ |
| 11 |
import { PanelBody, ToggleControl } from '@wordpress/components'; |
| 12 |
import { __ } from '@wordpress/i18n'; |
| 13 |
|
| 14 |
export default function EditProfileApprovedByAdminPanel( { attributes, setAttributes } ) { |
| 15 |
const enabled = attributes[ 'edit-profile-approved-by-admin' ] === 'yes'; |
| 16 |
|
| 17 |
return ( |
| 18 |
<PanelBody title={ __( 'Admin Approval', 'profile-builder' ) } initialOpen={ false }> |
| 19 |
<ToggleControl |
| 20 |
label={ __( 'Requires admin approval on Edit Profile', 'profile-builder' ) } |
| 21 |
checked={ enabled } |
| 22 |
onChange={ ( on ) => setAttributes( { 'edit-profile-approved-by-admin': on ? 'yes' : '' } ) } |
| 23 |
help={ __( 'When a non-admin user edits their profile, this field\'s value is held for admin review instead of being saved directly. Affects every form this field appears in.', 'profile-builder' ) } |
| 24 |
/> |
| 25 |
</PanelBody> |
| 26 |
); |
| 27 |
} |
| 28 |
|