PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13 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 All 211 releases
charitable / templates / form-fields / checkbox.php

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

65 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 /**
9 * The template used to display checkbox form fields.
10 *
11 * Override this template by copying it to yourtheme/charitable/form-fields/checkbox.php
12 *
13 * @author WP Charitable LLC
14 * @package Charitable/Templates/Form Fields
15 * @since 1.0.0
16 * @version 1.2.0
17 * @version 1.8.6.1 Added description.
18 * @version 1.8.8.6
19 */
20
21 if ( ! isset( $view_args['form'] ) || ! isset( $view_args['field'] ) ) {
22 return;
23 }
24
25 $charitable_form = $view_args['form'];
26 $charitable_field = $view_args['field'];
27 $charitable_classes = $view_args['classes'];
28 $charitable_is_required = isset( $charitable_field['required'] ) ? $charitable_field['required'] : false;
29 $charitable_value = isset( $charitable_field['value'] ) ? esc_attr( $charitable_field['value'] ) : '1';
30
31 if ( isset( $charitable_field['checked'] ) ) {
32 $charitable_checked = $charitable_field['checked'];
33 } else {
34 $charitable_checked = isset( $charitable_field['default'] ) ? $charitable_field['default'] : 0;
35 }
36 ?>
37 <div id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>" class="<?php echo esc_attr( $charitable_classes ); ?>">
38 <input
39 type="checkbox"
40 name="<?php echo esc_attr( $charitable_field['key'] ); ?>"
41 value="<?php echo esc_attr( $charitable_value ); ?>"
42 id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_element"
43 <?php checked( $charitable_checked ); ?>
44 <?php echo charitable_get_arbitrary_attributes( $charitable_field ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
45 />
46 <?php if ( isset( $charitable_field['label'] ) ) : ?>
47 <label for="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_element">
48 <?php echo wp_kses_post( $charitable_field['label'] ); ?>
49 <?php if ( $charitable_is_required ) : ?>
50 <abbr class="required" title="<?php esc_html_e( 'Required', 'charitable' ); ?>">*</abbr>
51 <?php endif ?>
52 </label>
53 <?php endif ?>
54 <?php if ( isset( $charitable_field['help'] ) ) : ?>
55 <p class="charitable-field-help"><?php echo wp_kses_post( $charitable_field['help'] ); ?></p>
56 <?php endif ?>
57 <?php
58
59 // If there is a description, add it after the input.
60 if ( isset( $charitable_field['description'] ) && ! empty( $charitable_field['description'] ) ) {
61 echo '<p class="charitable-field-description">' . wp_kses_post( $charitable_field['description'] ) . '</p>';
62 }
63
64 ?>
65 </div>