import React, { Component } from 'react'; class MultipleCheckboxes extends Component { static slug = 'mphb_multiple_checkboxes'; _onCheckboxChange = ( event ) => { const { value, checked } = event.target; const oldValue = this.props.value.split(','); let newValue; if ( checked ) { newValue = [ ...oldValue, value ]; } else { newValue = oldValue.filter( box => box !== value ) ; } this.props._onChange( this.props.name, newValue.join(',') ) } render() { let checkboxes_data = this.props.fieldDefinition.options; const checkboxes = Object.keys( checkboxes_data ).map( ( id, index ) => { return (
); }); return (