PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.3.9.1
Pods – Custom Content Types and Fields v3.3.9.1
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 / slider.php
pods / ui / fields Last commit date
_comment.php 2 weeks ago _db.php 2 weeks ago _hidden.php 2 weeks ago _label.php 2 weeks ago _row.php 2 weeks ago attachment.php 2 weeks ago checkbox.php 2 weeks ago cleditor.php 2 weeks ago codemirror.php 2 weeks ago color.php 2 weeks ago currency.php 2 weeks ago date.php 2 weeks ago datetime.php 2 weeks ago email.php 2 weeks ago link.php 2 weeks ago number.php 2 weeks ago oembed.php 2 weeks ago password.php 2 weeks ago phone.php 2 weeks ago radio.php 2 weeks ago select.php 2 weeks ago slider.php 2 weeks ago slug.php 2 weeks ago text.php 2 weeks ago textarea.php 2 weeks ago time.php 2 weeks ago tinymce.php 2 weeks ago website.php 2 weeks ago
slider.php
87 lines
1 <?php
2
3 // Don't load directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 die( '-1' );
6 }
7
8 // phpcs:ignoreFile WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
9
10 wp_enqueue_script( 'jquery-ui-slider' );
11 pods_form_enqueue_style( 'pods-styles' );
12
13 if ( is_array( $value ) ) {
14 $value = implode( ',', $value );
15 }
16
17 if ( strlen( $value ) < 1 ) {
18 $value = 0;
19 }
20
21 $values = explode( ',', $value );
22 $values = array(
23 (int) pods_v( 0, $values, pods_v( $form_field_type . '_min', $options, 0, true ) ),
24 (int) pods_v( 1, $values, pods_v( $form_field_type . '_max', $options, 100, true ) ),
25 );
26
27 $values[0] = max( $values[0], (int) pods_v( $form_field_type . '_min', $options, 0 ) );
28 $values[1] = min( $values[1], (int) pods_v( $form_field_type . '_min', $options, 100 ) );
29
30 if ( 0 === pods_v( $form_field_type . '_range', $options, 0 ) ) {
31 $value = $values[0];
32 $output_value = $value;
33 } else {
34 $value = implode( ',', $values );
35 $output_value = implode( ' - ', $values );
36 }
37
38 $attributes = array();
39 $attributes['type'] = 'hidden';
40 $attributes['value'] = $value;
41 $attributes = PodsForm::merge_attributes( $attributes, $name, $form_field_type, $options );
42 ?>
43 <input<?php PodsForm::attributes( $attributes, $name, $form_field_type, $options ); ?> />
44
45 <div class="pods-slider-field pods-compat-container">
46 <div id="<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>-range" class="pods-slider-range"></div>
47 <div id="<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>-amount-display" class="pods-slider-field-display">
48 <?php echo esc_html( $output_value ); ?>
49 </div>
50 </div>
51
52 <script>
53 jQuery( function ( $ ) {
54 $( "#<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>-range" ).slider( {
55 orientation : '<?php echo esc_js( pods_v( $form_field_type . '_orientation', $options, 'horizontal' ) ); ?>',
56 min : <?php echo esc_js( pods_v( $form_field_type . '_min', $options, 0 ) ); ?>,
57 max : <?php echo esc_js( pods_v( $form_field_type . '_max', $options, 100 ) ); ?>,
58 step : <?php echo esc_js( pods_v( $form_field_type . '_step', $options, 1 ) ); ?>,
59
60 <?php
61 if ( 1 === (int) pods_v( $form_field_type . '_range', $options, 0 ) ) {
62 ?>
63 range : true,
64 values : [
65 <?php echo esc_js( $values[0] ); ?>,
66 <?php echo esc_js( $values[1] ); ?>
67 ],
68 slide : function ( event, ui ) {
69 $( "#<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>" ).val( ui.values[0] + ',' + ui.values[1] );
70 $( "#<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>-amount-display" ).html( ui.values[0] + ' - ' + ui.values[1] );
71 }
72 <?php
73 } else {
74 ?>
75 range : false,
76 value : <?php echo esc_js( $value ); ?>,
77 slide : function ( event, ui ) {
78 $( "#<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>" ).val( ui.value );
79 $( "#<?php echo esc_js( pods_js_name( $attributes['id'] ) ); ?>-amount-display" ).html( ui.value );
80 }
81 <?php
82 }//end if
83 ?>
84 } );
85 } );
86 </script>
87