args_to_props($args); } /** * Range Enqueue. * * @return void */ public function enqueue() { $css_path = DIVI_TORQUE_LITE_URL . '/includes/deprecated/customizer/controls/css/'; $js_path = DIVI_TORQUE_LITE_URL . '/includes/deprecated/customizer/controls/js/'; $file_prefix = (defined('DTQ_DEBUG') && true === constant('DTQ_DEBUG')) ? '' : '.min'; wp_enqueue_script( 'brainaddons-range-control', $js_path . 'range-control' . $file_prefix . '.js', array('customize-controls'), DIVI_TORQUE_LITE_VERSION, true ); wp_enqueue_style( 'brainaddons-range', $css_path . 'range' . $file_prefix . '.css', false, DIVI_TORQUE_LITE_VERSION ); } /** * Handles input value. * * @return array */ public function json() { $json = parent::json(); $json['value'] = json_decode($this->value(), true); $json['link'] = $this->get_link(); $json['media_query'] = $this->media_query; $json['step'] = $this->step; $json['sum_type'] = $this->sum_type; $json['inputAttr'] = $this->input_attr; return $json; } /** * Render the title for the control. */ private function render_title() { ?> <# if ( data.label ) { #> {{{ data.label }}} <# if ( data.description ) { #> <# } #> <# if( data.media_query===true ) { #> render_responsive_switches(); ?> <# } #> <# } #> <# var type=data.sum_type ? 'text' : 'number' ; var value=data.value ? data.value[mediaQuery] : attr.default; if( ! data.media_query ) { value=data.value? data.value : attr.default } var active=mediaQuery==='desktop' ? 'active' : '' ; if( data.sum_type ) { value='+' + value; } #>
render_title(); ?> <# var wrapClass=data.media_query ? 'has-media-queries' : '' ; #>
<# if( data.media_query===true ) { #> <# _.each( data.inputAttr, function( attr, mediaQuery ) { #> render_input(); ?> <# } ) #> <# } else { var mediaQuery='desktop' ; var attr=data.inputAttr; #> render_input(); ?> <# } #> input_attr = $args['input_attr']; } if (!empty($args['media_query'])) { $this->media_query = (bool) $args['media_query']; } if ( !isset($this->input_attr['mobile']) || !isset($this->input_attr['tablet']) || !isset($this->input_attr['desktop']) ) { $this->media_query = false; } if (!empty($args['sum_type'])) { $this->sum_type = $args['sum_type']; } if (!empty($args['step'])) { $this->step = $args['step']; } } }