PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.6.9
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.6.9
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.6.9, at templates/form-fields/select.php

61 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 select form fields.
4 *
5 * @author Studio 164a
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'] ) ? $field['value'] : '';
21
22 if ( is_array( $value ) ) {
23 $value = current( $value );
24 }
25
26 if ( count( $options ) ) :
27
28 ?>
29 <div id="charitable_field_<?php echo $field['key'] ?>" class="<?php echo esc_attr( $classes ) ?>">
30 <?php if ( isset( $field['label'] ) ) : ?>
31 <label for="charitable_field_<?php echo esc_attr( $field['key'] ) ?>_element">
32 <?php echo $field['label'] ?>
33 <?php if ( $is_required ) : ?>
34 <abbr class="required" title="required">*</abbr>
35 <?php endif ?>
36 </label>
37 <?php endif ?>
38 <select name="<?php echo $field['key'] ?>" id="charitable_field_<?php echo esc_attr( $field['key'] ) ?>_element">
39 <?php
40 foreach ( $options as $val => $label ) :
41
42 if ( is_array( $label ) ) : ?>
43 <optgroup label="<?php echo esc_attr( $val ) ?>">
44 <?php foreach ( $label as $val => $label ) : ?>
45 <option value="<?php echo esc_attr( $val ) ?>" <?php selected( $val, $value ) ?>><?php echo $label ?></option>
46 <?php endforeach; ?>
47 </optgroup>
48 <?php else : ?>
49 <option value="<?php echo esc_attr( $val ) ?>" <?php selected( $val, $value ) ?>><?php echo $label ?></option>
50 <?php
51
52 endif;
53 endforeach;
54
55 ?>
56 </select>
57 </div>
58 <?php
59
60 endif;
61