PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.7.0
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.7.0
1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 1.8.0 All 210 releases
charitable / templates / form-fields / multi-checkbox.php

multi-checkbox.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.7.0, at templates/form-fields/multi-checkbox.php

52 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The template used to display form fields with multiple checkboxes.
4 *
5 * @author WP Charitable LLC
6 * @package Charitable/Templates/Form Fields
7 * @since 1.0.0
8 * @version 1.0.0
9 */
10
11 if ( ! isset( $view_args['form'] ) || ! isset( $view_args['field'] ) ) {
12 return;
13 }
14
15 $form = $view_args['form'];
16 $field = $view_args['field'];
17 $classes = $view_args['classes'];
18 $is_required = isset( $field['required'] ) ? $field['required'] : false;
19 $options = isset( $field['options'] ) ? $field['options'] : array();
20 $value = isset( $field['value'] ) ? (array) $field['value'] : array();
21
22 if ( empty( $options ) ) {
23 return;
24 }
25 ?>
26 <div id="charitable_field_<?php echo esc_attr( $field['key'] ); ?>" class="<?php echo $classes; ?>">
27 <fieldset class="charitable-fieldset-field-wrapper">
28 <?php if ( isset( $field['label'] ) ) : ?>
29 <div class="charitable-fieldset-field-header" id="charitable_field_<?php echo esc_attr( $field['key'] ); ?>_label">
30 <?php echo $field['label']; ?>
31 <?php if ( $is_required ) : ?>
32 <abbr class="required" title="required">*</abbr>
33 <?php endif ?>
34 </div>
35 <?php endif ?>
36 <ul class="charitable-checkbox-list options">
37 <?php foreach ( $options as $val => $label ) : ?>
38 <li>
39 <input type="checkbox"
40 id="<?php echo esc_attr( $field['key'] . '-' . $val ); ?>"
41 name="<?php echo $field['key']; ?>[]"
42 value="<?php echo $val; ?>"
43 aria-describedby="charitable_field_<?php echo esc_attr( $field['key'] ); ?>_label"
44 <?php checked( in_array( $val, $value ) ); ?>
45 <?php echo charitable_get_arbitrary_attributes( $field ); ?> />
46 <label for="<?php echo esc_attr( $field['key'] . '-' . $val ); ?>"><?php echo $label; ?></label>
47 </li>
48 <?php endforeach ?>
49 </ul>
50 </fieldset>
51 </div>
52