PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.1.4.3
Pods – Custom Content Types and Fields v3.1.4.3
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 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 / checkbox.php
pods / ui / fields Last commit date
_comment.php 1 day ago _db.php 1 day ago _hidden.php 1 day ago _label.php 1 day ago _row.php 1 day ago attachment.php 1 day ago checkbox.php 1 day ago cleditor.php 1 day ago codemirror.php 1 day ago color.php 1 day ago currency.php 1 day ago date.php 1 day ago datetime.php 1 day ago email.php 1 day ago link.php 1 day ago number.php 1 day ago oembed.php 1 day ago password.php 1 day ago phone.php 1 day ago radio.php 1 day ago select.php 1 day ago slider.php 1 day ago slug.php 1 day ago text.php 1 day ago textarea.php 1 day ago time.php 1 day ago tinymce.php 1 day ago website.php 1 day ago
checkbox.php
123 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 $data_count = count( $options['data'] );
10
11 if ( 0 < $data_count ) {
12
13 if ( 1 == pods_var( 'grouped', $options, 0, null, true ) ) {
14 ?>
15 <div class="pods-pick-values pods-pick-checkbox">
16 <ul>
17 <?php
18 }
19
20 $counter = 1;
21 $primary_name = $name;
22 $primary_id = 'pods-form-ui-' . PodsForm::clean( $name );
23
24 foreach ( $options['data'] as $val => $label ) {
25 if ( is_array( $label ) ) {
26 if ( isset( $label['label'] ) ) {
27 $label = $label['label'];
28 } else {
29 $label = $val;
30 }
31 }
32
33 $attributes = array();
34
35 $attributes['type'] = 'checkbox';
36 $attributes['tabindex'] = 2;
37
38 if ( ( ! is_array( $value ) && (string) $val === (string) $value ) || ( is_array( $value ) && ( in_array( $val, $value ) || in_array( (string) $val, $value ) ) ) ) {
39 $attributes['checked'] = 'CHECKED';
40 }
41
42 $attributes['value'] = $val;
43
44 if ( 1 < $data_count && false === strpos( $primary_name, '[]' ) ) {
45 $name = $primary_name . '[' . ( $counter - 1 ) . ']';
46 }
47
48 $attributes = PodsForm::merge_attributes( $attributes, $name, $form_field_type, $options );
49
50 $indent = '';
51
52 $indent_count = substr_count( $label, '&nbsp;&nbsp;&nbsp;' );
53
54 if ( 0 < $indent_count ) {
55 $label = str_replace( '&nbsp;&nbsp;&nbsp;', '', $label );
56
57 $indent = ' style="margin-left:' . ( 18 * $indent_count ) . 'px;"';
58 }
59
60 if ( 1 < $data_count && false === strpos( $primary_name, '[]' ) ) {
61 $attributes['class'] .= ' pods-dependent-multi';
62 }
63
64 if ( strlen( $label ) < 1 ) {
65 $attributes['class'] .= ' pods-form-ui-no-label';
66 }
67
68 if ( pods_var( 'readonly', $options, false ) ) {
69 $attributes['readonly'] = 'READONLY';
70 $attributes['disabled'] = 'DISABLED';
71
72 $attributes['class'] .= ' pods-form-ui-read-only';
73 }
74
75 if ( 1 < $data_count ) {
76 $attributes['id'] = $primary_id . $counter;
77 }
78
79 if ( 1 == pods_var( 'grouped', $options, 0, null, true ) ) {
80 ?>
81 <li>
82 <?php
83 }
84 ?>
85 <div class="pods-field pods-boolean"<?php echo $indent; ?>>
86 <input<?php PodsForm::attributes( $attributes, $name, $form_field_type, $options ); ?> />
87 <?php
88 if ( isset( $attributes['readonly'] ) && isset( $attributes['checked'] ) && 'CHECKED' === $attributes['checked'] ) {
89 ?>
90 <input type="hidden" name="<?php echo esc_attr( $name ); ?>" value="<?php echo esc_attr( $attributes['value'] ); ?>" />
91 <?php
92 }
93
94 if ( 0 < strlen( $label ) ) {
95 $help = pods_var_raw( 'help', $options );
96
97 if ( 1 == pods_var( 'grouped', $options, 0, null, true ) || empty( $help ) ) {
98 $help = '';
99 }
100
101 echo PodsForm::label( $attributes['id'], $label, $help );
102 }
103 ?>
104 </div>
105 <?php
106
107 if ( 1 == pods_var( 'grouped', $options, 0, null, true ) ) {
108 ?>
109 </li>
110 <?php
111 }
112
113 $counter ++;
114 }//end foreach
115
116 if ( 1 == pods_var( 'grouped', $options, 0, null, true ) ) {
117 ?>
118 </ul>
119 </div>
120 <?php
121 }
122 }//end if
123