Last active
May 22, 2020 05:10
-
-
Save ericnicolaas/60277d2b75ea10719b8ef324c1728364 to your computer and use it in GitHub Desktop.
Add "Waiver Agreement" fields to campaign form on initial submission
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( | |
'charitable_campaign_submission_fields', | |
function( $fields, $form ) { | |
$waiver_fields = array( | |
'legend' => 'Liability Waiver and Release', | |
'type' => 'fieldset', | |
'fields' => array( | |
'waiver' => array( | |
'type' => 'paragraph', | |
'priority' => 1, | |
'fullwidth' => true, | |
'content' => 'My Waiver', | |
'editable' => false, | |
), | |
'waiver_agreement' => array( | |
'label' => 'I read and agree to the liability waiver.', | |
'type' => 'checkbox', | |
'value' => 1, | |
'priority' => 2, | |
'required' => true, | |
'checked' => $form->get_campaign_value( 'waiver_agreement' ), | |
'data_type' => 'meta', | |
'fullwidth' => true, | |
'editable' => false, | |
), | |
) | |
); | |
$waiver_fields = $form->filter_non_editable_fields( $waiver_fields ); | |
if ( ! empty( $waiver_fields['fields'] ) ) { | |
$fields['waiver_fields'] = $waiver_fields; | |
} | |
return $fields; | |
}, | |
10, | |
2 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment