/** * Refresh the parameters passed to the JavaScript via JSON. * * @since 3.4.0 * * @uses WP_Customize_Media_Control::to_json() */ public function to_json() { parent::to_json(); $value = $this->value(); if ($value) { // Get the attachment model for the existing file. $attachment_id = attachment_url_to_postid($value); if ($attachment_id) { $this->json['attachment'] = wp_prepare_attachment_for_js($attachment_id); } } }
/** * Refresh the parameters passed to the JavaScript via JSON. * * @since 4.3.0 * @access public * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['width'] = absint($this->width); $this->json['height'] = absint($this->height); $this->json['flex_width'] = absint($this->flex_width); $this->json['flex_height'] = absint($this->flex_height); }