PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.2.7
Pods – Custom Content Types and Fields v3.2.7
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 2 years ago _row.php 2 years ago attachment.php 2 years ago checkbox.php 2 years ago cleditor.php 2 years ago codemirror.php 2 years ago color.php 2 years ago currency.php 2 years ago date.php 2 years ago datetime.php 2 years ago email.php 2 years ago link.php 2 years ago number.php 2 years ago oembed.php 2 years ago password.php 2 years ago phone.php 2 years ago radio.php 2 years ago select.php 2 years ago slider.php 2 years ago slug.php 2 years ago text.php 2 years ago textarea.php 2 years ago time.php 2 years ago tinymce.php 2 years 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_var_raw( 'data', $options, array(), null, true );
8
9 if ( 1 == pods_var( 'grouped', $options, 0, null, true ) ) {
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 ( pods_var( '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 == pods_var( 'grouped', $options, 0, null, true ) ) {
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_var_raw( 'help', $options );
77
78 if ( 1 == pods_var( 'grouped', $options, 0, null, true ) || empty( $help ) ) {
79 $help = '';
80 }
81
82 echo PodsForm::label( $attributes['id'], $label, $help );
83 }
84 ?>
85 </div>
86 <?php
87
88 if ( 1 == pods_var( 'grouped', $options, 0, null, true ) ) {
89 ?>
90 </li>
91 <?php
92 }
93
94 $counter ++;
95 }//end foreach
96
97 if ( 1 == pods_var( 'grouped', $options, 0, null, true ) ) {
98 ?>
99 </ul>
100 </div>
101 <?php
102 }
103