register_control_type( 'Epsilon_Control_Image' ); } /** * Add custom parameters to pass to the JS via JSON. * * @since 1.2.0 * @access public */ public function json() { $json = parent::json(); $json['id'] = $this->id; $json['link'] = $this->get_link(); $json['stringifiedVal'] = $this->value(); $json['value'] = $this->sanitize_value(); $json['default'] = $this->default; $json['size'] = $this->size; $json['sizeArray'] = Epsilon_Helper::get_image_sizes(); return $json; } /** * Sanitize the result so we can use it * * @since 1.2.0 * @access private */ private function sanitize_value() { $val = json_decode( $this->value() ); return $val; } /** * Empty, as it should be * * @since 1.0.0 */ public function render_content() { } /** * Controller template * * @since 1.0.0 */ public function content_template() { //@formatter:off ?>
value="{{ data.stringifiedVal }}" <# } #> /> <# if ( ! _.isEmpty( data.value ) && data.value.url ) { #>
<# } else { #>
<# if ( ! _.isUndefined( data.sizeArray[data.size] ) ) { #> {{{ data.sizeArray[data.size].width }}} x {{{ data.sizeArray[data.size].height }}} <# } #>
<# } #>