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 / radio.php

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

91 lines 3.3 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 radio form fields.
4 *
5 * Override this template by copying it to yourtheme/charitable/form-fields/radio.php
6 *
7 * @author WP Charitable LLC
8 * @package Charitable/Templates/Form Fields
9 * @since 1.0.0
10 * @version 1.0.0
11 * @version 1.8.6.1 Added description output.
12 * @version 1.8.6.1 Added SVG support to label.
13 * @version 1.8.8.6
14 */
15
16 // Exit if accessed directly.
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit;
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_options = isset( $charitable_field['options'] ) ? $charitable_field['options'] : array();
30 $charitable_value = isset( $charitable_field['value'] ) ? $charitable_field['value'] : '';
31
32 if ( empty( $charitable_options ) ) {
33 return;
34 }
35
36 ?>
37 <div id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>" class="<?php echo esc_attr( $charitable_classes ); ?>">
38 <fieldset class="charitable-fieldset-field-wrapper">
39 <?php if ( isset( $charitable_field['label'] ) ) : ?>
40 <div class="charitable-fieldset-field-header" id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_label">
41 <?php echo wp_kses_post( $charitable_field['label'] ); ?>
42 <?php if ( $charitable_is_required ) : ?>
43 <abbr class="required" title="<?php esc_html_e( 'Required', 'charitable' ); ?>">*</abbr>
44 <?php endif ?>
45 </div>
46 <?php endif ?>
47 <ul class="charitable-radio-list <?php echo esc_attr( $view_args['classes'] ); ?>">
48 <?php foreach ( $charitable_options as $charitable_option => $charitable_label ) : ?>
49 <li><input type="radio"
50 id="<?php echo esc_attr( $charitable_field['key'] . '-' . $charitable_option ); ?>"
51 name="<?php echo esc_attr( $charitable_field['key'] ); ?>"
52 value="<?php echo esc_attr( $charitable_option ); ?>"
53 aria-describedby="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_label"
54 <?php checked( $charitable_value, $charitable_option ); ?>
55 <?php echo charitable_get_arbitrary_attributes( $charitable_field ); // phpcs:ignore ?> />
56 <?php
57 $charitable_allowed_html = array_merge(
58 wp_kses_allowed_html( 'post' ),
59 array(
60 'svg' => array(
61 'class' => true,
62 'aria-hidden' => true,
63 'aria-labelledby' => true,
64 'role' => true,
65 'xmlns' => true,
66 'width' => true,
67 'height' => true,
68 'viewbox' => true
69 ),
70 'path' => array(
71 'd' => true,
72 'fill' => true
73 )
74 )
75 );
76 ?>
77 <label for="<?php echo esc_attr( $charitable_field['key'] . '-' . $charitable_option ); ?>"><?php echo wp_kses( $charitable_label, $charitable_allowed_html ); ?></label>
78 </li>
79 <?php endforeach ?>
80 </ul>
81 <?php
82
83 // If there is a description, add it after the input.
84 if ( isset( $charitable_field['description'] ) && ! empty( $charitable_field['description'] ) ) {
85 echo '<p class="charitable-field-description">' . wp_kses_post( $charitable_field['description'] ) . '</p>';
86 }
87
88 ?>
89 </fieldset>
90 </div>
91