json['l10n'] = Kirki_Toolkit::i18n(); $this->json['choices'] = array(); if ( is_array( $this->choices ) ) { foreach ( $this->choices as $choice => $value ) { if ( true === $value ) { $this->json['choices'][ $choice ] = true; } } } if ( is_array( $this->json['default'] ) ) { foreach ( $this->json['default'] as $key => $value ) { if ( isset( $this->json['choices'][ $key ] ) && ! isset( $this->json['value'][ $key ] ) ) { $this->json['value'][ $key ] = $value; } } } } protected function content_template() { ?> <# if ( data.tooltip ) { #> <# } #> <# if ( data.label ) { #> {{{ data.label }}} <# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #> <# for ( choiceKey in data.choices ) { #> {{ data.l10n[ choiceKey ] }} <# if ( data.choices['units'] ) { #> <# for ( key in data.choices['units'] ) { #> selected <# } #>>{{ data.choices['units'][ key ] }} <# } #> <# } else { #> <# if ( data.value && data.value[ choiceKey ] ) { #> <# var units = data.value[ choiceKey ].replace( parseFloat( data.value[ choiceKey ] ), '' ); #> <# } else { #> <# var units = 'px'; #> <# } #> selected <# } #>>px selected <# } #>>em selected <# } #>>% <# } #> <# } #>