Your IP : 3.128.201.196


Current Path : /home/church/public_html/wp-content/plugins/ninja-forms/src/components/
Upload File :
Current File : /home/church/public_html/wp-content/plugins/ninja-forms/src/components/selectForms.js

import { SelectControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import PropTypes from 'prop-types';

export const SelectForms = ( props ) => {
	const forms = typeof props.forms !== 'undefined' ? props.forms : {};
	const options = [];
	for ( const [ key, value ] of Object.entries( forms ) ) {
		options.push( {
			value: value.formID,
			label: value.formTitle,
		} );
	}

	return (
		<SelectControl
			style={ { minHeight: '10em' } }
			hideLabelFromVision="true"
			label={ __( 'Select Forms', 'ninja-forms' ) }
			multiple={ true }
			options={ options }
			onChange={ ( value ) => props.setForms( value ) }
		/>
	);
};

SelectForms.propTypes = {
	setForms: PropTypes.func.isRequired,
	forms: PropTypes.object
}