PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.12
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.12
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 / select.php

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

72 lines 2.5 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 select form fields.
10 *
11 * @author WP Charitable LLC
12 * @package Charitable/Templates/Form Fields
13 * @since 1.0.0
14 * @version 1.0.0
15 * @version 1.8.8.6
16 */
17
18 if ( ! isset( $view_args['form'] ) || ! isset( $view_args['field'] ) ) {
19 return;
20 }
21
22 $charitable_form = $view_args['form'];
23 $charitable_field = $view_args['field'];
24 $charitable_classes = $view_args['classes'];
25 $charitable_is_required = isset( $charitable_field['required'] ) ? $charitable_field['required'] : false;
26 $charitable_options = isset( $charitable_field['options'] ) ? $charitable_field['options'] : array();
27 $charitable_value = isset( $charitable_field['value'] ) ? $charitable_field['value'] : '';
28
29 if ( is_array( $charitable_value ) ) {
30 $charitable_value = current( $charitable_value );
31 }
32
33 if ( count( $charitable_options ) ) :
34
35 ?>
36 <div id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>" class="<?php echo esc_attr( $charitable_classes ); ?>">
37 <?php if ( isset( $charitable_field['label'] ) ) : ?>
38 <label for="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_element">
39 <?php echo wp_kses_post( $charitable_field['label'] ); ?>
40 <?php if ( $charitable_is_required ) : ?>
41 <abbr class="required" title="<?php esc_html_e( 'Required', 'charitable' ); ?>">*</abbr>
42 <?php endif ?>
43 </label>
44 <?php endif ?>
45 <select name="<?php echo esc_attr( $charitable_field['key'] ); ?>" id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_element">
46 <?php
47 foreach ( $charitable_options as $charitable_val => $charitable_label ) :
48
49 if ( is_array( $charitable_label ) ) :
50 ?>
51 <optgroup label="<?php echo esc_attr( $charitable_val ); ?>">
52 <?php foreach ( $charitable_label as $charitable_val => $charitable_label ) : ?>
53 <option value="<?php echo esc_attr( $charitable_val ); ?>" <?php selected( $charitable_val, $charitable_value ); ?>><?php echo esc_html( $charitable_label ); ?></option>
54 <?php endforeach; ?>
55 </optgroup>
56 <?php else : ?>
57 <option value="<?php echo esc_attr( $charitable_val ); ?>" <?php selected( $charitable_val, $charitable_value ); ?>><?php echo esc_html( $charitable_label ); ?></option>
58 <?php
59
60 endif;
61 endforeach;
62
63 ?>
64 </select>
65 <?php if ( isset( $charitable_field['help'] ) ) : ?>
66 <p class="charitable-field-help"><?php echo $charitable_field['help']; // phpcs:ignore ?></p>
67 <?php endif ?>
68 </div>
69 <?php
70
71 endif;
72