PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 2.8.23.4
Pods – Custom Content Types and Fields v2.8.23.4
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
84 lines
1 <?php
2 // Don't load directly.
3 if ( ! defined( 'ABSPATH' ) ) {
4 die( '-1' );
5 }
6
7 wp_enqueue_script( 'jquery-ui-slider' );
8 pods_form_enqueue_style( 'pods-styles' );
9
10 if ( is_array( $value ) ) {
11 $value = implode( ',', $value );
12 }
13
14 if ( strlen( $value ) < 1 ) {
15 $value = 0;
16 }
17
18 $values = explode( ',', $value );
19 $values = array(
20 pods_var( 0, $values, pods_var( $form_field_type . '_min', $options, 0, null, true ) ),
21 pods_var( 1, $values, pods_var( $form_field_type . '_max', $options, 100, null, true ) ),
22 );
23
24 $values[0] = max( $values[0], pods_var( $form_field_type . '_min', $options, 0 ) );
25 $values[1] = min( $values[1], pods_var( $form_field_type . '_min', $options, 100 ) );
26
27 if ( 0 == pods_var( $form_field_type . '_range', $options, 0 ) ) {
28 $value = $values[0];
29 $output_value = $value;
30 } else {
31 $value = implode( ',', $values );
32 $output_value = implode( ' - ', $values );
33 }
34
35 $attributes = array();
36 $attributes['type'] = 'hidden';
37 $attributes['value'] = $value;
38 $attributes = PodsForm::merge_attributes( $attributes, $name, $form_field_type, $options );
39 ?>
40 <input<?php PodsForm::attributes( $attributes, $name, $form_field_type, $options ); ?> />
41
42 <div class="pods-slider-field pods-compat-container">
43 <div id="<?php echo esc_js( $attributes['id'] ); ?>-range" class="pods-slider-range"></div>
44 <div id="<?php echo esc_js( $attributes['id'] ); ?>-amount-display" class="pods-slider-field-display">
45 <?php echo $output_value; ?>
46 </div>
47 </div>
48
49 <script>
50 jQuery( function ( $ ) {
51 $( "#<?php echo esc_js( $attributes['id'] ); ?>-range" ).slider( {
52 orientation : '<?php echo esc_js( pods_v( $form_field_type . '_orientation', $options, 'horizontal' ) ); ?>',
53 min : <?php echo esc_js( pods_v( $form_field_type . '_min', $options, 0 ) ); ?>,
54 max : <?php echo esc_js( pods_v( $form_field_type . '_max', $options, 100 ) ); ?>,
55 step : <?php echo esc_js( pods_v( $form_field_type . '_step', $options, 1 ) ); ?>,
56
57 <?php
58 if ( 1 == pods_var( $form_field_type . '_range', $options, 0 ) ) {
59 ?>
60 range : true,
61 values : [
62 <?php echo esc_js( $values[0] ); ?>,
63 <?php echo esc_js( $values[1] ); ?>
64 ],
65 slide : function ( event, ui ) {
66 $( "#<?php echo esc_js( $attributes['id'] ); ?>" ).val( ui.values[0] + ',' + ui.values[1] );
67 $( "#<?php echo esc_js( $attributes['id'] ); ?>-amount-display" ).html( ui.values[0] + ' - ' + ui.values[1] );
68 }
69 <?php
70 } else {
71 ?>
72 range : false,
73 value : <?php echo esc_js( $value ); ?>,
74 slide : function ( event, ui ) {
75 $( "#<?php echo esc_js( $attributes['id'] ); ?>" ).val( ui.value );
76 $( "#<?php echo esc_js( $attributes['id'] ); ?>-amount-display" ).html( ui.value );
77 }
78 <?php
79 }//end if
80 ?>
81 } );
82 } );
83 </script>
84