total = absint( $total ); parent::__construct( $manager, $id, $args ); } /** * Add custom parameters to pass to the JS via JSON. * * @since 1.0.0 */ public function to_json() { parent::to_json(); $this->json['value'] = ! is_array( $this->value() ) ? explode( '|', $this->value() ) : $this->value(); $this->json['total'] = $this->total; $this->json['choices'] = $this->choices; $this->json['link'] = $this->get_link(); $this->json['id'] = $this->id; } /** * Enqueue scripts and styles. * * @since 1.0.0 */ public function enqueue() { wp_enqueue_style( 'business-key-customize-controls' ); wp_enqueue_script( 'business-key-customize-controls' ); } /** * Content template. * * @since 1.0.0 */ public function content_template() { ?> <# if ( ! data.choices ) { return; } #> <# if ( data.label ) { #> {{ data.label }} <# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #> <# var $_items = _.range( data.total ) #> <# var cnt = 0 #> <# _.each( $_items, function() { #> <# cnt++ #> <# } ) #>