PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 2.9.19.5
Pods – Custom Content Types and Fields v2.9.19.5
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 3 days ago _db.php 3 days ago _hidden.php 3 days ago _label.php 3 days ago _row.php 3 days ago attachment.php 3 days ago checkbox.php 3 days ago cleditor.php 3 days ago codemirror.php 3 days ago color.php 3 days ago currency.php 3 days ago date.php 3 days ago datetime.php 3 days ago email.php 3 days ago link.php 3 days ago number.php 3 days ago oembed.php 3 days ago password.php 3 days ago phone.php 3 days ago radio.php 3 days ago select.php 3 days ago slider.php 3 days ago slug.php 3 days ago text.php 3 days ago textarea.php 3 days ago time.php 3 days ago tinymce.php 3 days ago website.php 3 days 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