GC_Customize_Upload_Control::to_json()

最后更新于:2021-11-27 09:36:41

GC_Customize_Upload_Control::to_json()

Refresh the parameters passed to the JavaScript via JSON.

源文件

文件: gc-includes/customize/class-gc-customize-upload-control.php

	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'] = gc_prepare_attachment_for_js( $attachment_id );
			}
		}
	}