Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
wp.domReady( function() {
wp.blocks.registerBlockVariation( 'coblocks/form', {
name: 'event-registration',
title: 'Event Registration',
icon: '<svg height="48" viewBox="0 0 48 48" width="48" xmlns="http://www.w3.org/2000/svg"><path d="m18 10h-14v2h14zm2-8h-1v-2h-2v2h-12v-2h-2v2h-1c-1.11 0-1.99.9-1.99 2l-.01 16c0 1.1.89 2 2 2h18c1.1 0 2-.9 2-2v-16c0-1.1-.9-2-2-2zm0 18h-18v-13h18zm-5-5h-6-5v2h11z" transform="translate(13 14)"/></svg>',
innerBlocks: [
[ 'coblocks/field-name', { label: 'Full name', hasLastName: true } ],
[ 'coblocks/field-email', { required: true } ],
[ 'coblocks/field-radio', { label: 'How do you use WordPress?', required: true, options: [ 'I write', 'I design', 'I develop', 'I manage', 'I am new to WordPress!'] } ],
[ 'coblocks/field-checkbox', { label: 'I’m on a gluten-free diet', options: [ 'Yes', 'No' ], required: true } ],
[ 'coblocks/field-checkbox', { label: 'We can also provide specially prepared meals if needed', options: [ 'Kosher', 'Halal', 'None' ] } ],
[ 'coblocks/field-textarea', { label: 'Any other dietary needs?', required: true } ],
[ 'coblocks/field-checkbox', { label: 'Do you agree to follow the event Code of Conduct?', options: [ 'Yes' ] } ],
[ 'coblocks/field-submit-button', { submitButtonText: 'Register' } ],
],
scope: [ 'block' ],
} );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.