PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.4
Pods – Custom Content Types and Fields v3.3.4
trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / ui / fields / radio.php
pods / ui / fields Last commit date
_comment.php 2 years ago _db.php 2 years ago _hidden.php 2 years ago _label.php 1 year ago _row.php 2 years ago attachment.php 1 year ago checkbox.php 1 year ago cleditor.php 2 years ago codemirror.php 2 years ago color.php 2 years ago currency.php 1 year ago date.php 2 years ago datetime.php 2 years ago email.php 1 year ago link.php 1 year ago number.php 1 year ago oembed.php 1 year ago password.php 1 year ago phone.php 1 year ago radio.php 1 year ago select.php 1 year ago slider.php 1 year ago slug.php 2 years ago text.php 1 year ago textarea.php 1 year ago time.php 2 years ago tinymce.php 1 year ago website.php 2 years ago
radio.php
103 lines
1 <?php
2 // Don't load directly.
3 if ( ! defined( 'ABSPATH' ) ) {
4 die( '-1' );
5 }
6
7 $options['data'] = (array) pods_v( 'data', $options, [] );
8
9 if ( 1 === (int) pods_v( 'grouped', $options, 0 ) ) {
10 ?>
11 <div class="pods-pick-values pods-pick-radio">
12 <ul>
13 <?php
14 }
15
16 $counter = 1;
17 $primary_name = $name;
18 $primary_id = 'pods-form-ui-' . PodsForm::clean( $name );
19 $selection_made = false;
20
21 foreach ( $options['data'] as $val => $label ) {
22 if ( is_array( $label ) ) {
23 if ( isset( $label['label'] ) ) {
24 $label = $label['label'];
25 } else {
26 $label = $val;
27 }
28 }
29
30 $attributes = array();
31
32 $attributes['type'] = 'radio';
33
34 $attributes['checked'] = null;
35 $attributes['tabindex'] = 2;
36
37 if ( ! $selection_made && ( $val == $value || ( is_array( $value ) && in_array( $val, $value ) ) ) ) {
38 $attributes['checked'] = 'CHECKED';
39 $selection_made = true;
40 }
41
42 $attributes['value'] = $val;
43
44 $attributes = PodsForm::merge_attributes( $attributes, $name, $form_field_type, $options );
45
46 $indent = '';
47
48 $indent_count = substr_count( $label, '&nbsp;&nbsp;&nbsp;' );
49
50 if ( 0 < $indent_count ) {
51 $label = str_replace( '&nbsp;&nbsp;&nbsp;', '', $label );
52
53 $indent = ' style="margin-left:' . ( 18 * $indent_count ) . 'px;"';
54 }
55
56 if ( (bool) pods_v( 'readonly', $options, false ) ) {
57 $attributes['readonly'] = 'READONLY';
58
59 $attributes['class'] .= ' pods-form-ui-read-only';
60 }
61
62 if ( 1 < count( $options['data'] ) ) {
63 $attributes['id'] = $primary_id . $counter;
64 }
65
66 if ( 1 === (int) pods_v( 'grouped', $options, 0 ) ) {
67 ?>
68 <li>
69 <?php
70 }
71 ?>
72 <div class="pods-field pods-boolean"<?php echo $indent; ?>>
73 <input<?php PodsForm::attributes( $attributes, $name, $form_field_type, $options ); ?> />
74 <?php
75 if ( 0 < strlen( $label ) ) {
76 $help = pods_v( 'help', $options );
77
78 if ( 1 === (int) pods_v( 'grouped', $options, 0 ) || empty( $help ) ) {
79 $help = '';
80 }
81
82 echo PodsForm::label( $attributes['id'], $label, $help );
83 }
84 ?>
85 </div>
86 <?php
87
88 if ( 1 === (int) pods_v( 'grouped', $options, 0 ) ) {
89 ?>
90 </li>
91 <?php
92 }
93
94 $counter ++;
95 }//end foreach
96
97 if ( 1 === (int) pods_v( 'grouped', $options, 0 ) ) {
98 ?>
99 </ul>
100 </div>
101 <?php
102 }
103