wp/wp-includes/customize/class-wp-customize-media-control.php
changeset 21 48c4eec2b7e6
parent 18 be944660c56a
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    86 
    86 
    87 		$value = $this->value();
    87 		$value = $this->value();
    88 
    88 
    89 		if ( is_object( $this->setting ) ) {
    89 		if ( is_object( $this->setting ) ) {
    90 			if ( $this->setting->default ) {
    90 			if ( $this->setting->default ) {
    91 				// Fake an attachment model - needs all fields used by template.
    91 				/*
    92 				// Note that the default value must be a URL, NOT an attachment ID.
    92 				 * Fake an attachment model - needs all fields used by template.
       
    93 				 * Note that the default value must be a URL, NOT an attachment ID.
       
    94 				 */
    93 				$ext  = substr( $this->setting->default, -3 );
    95 				$ext  = substr( $this->setting->default, -3 );
    94 				$type = in_array( $ext, array( 'jpg', 'png', 'gif', 'bmp', 'webp' ), true ) ? 'image' : 'document';
    96 				$type = in_array( $ext, array( 'jpg', 'png', 'gif', 'bmp', 'webp', 'avif' ), true ) ? 'image' : 'document';
    95 
    97 
    96 				$default_attachment = array(
    98 				$default_attachment = array(
    97 					'id'    => 1,
    99 					'id'    => 1,
    98 					'url'   => $this->setting->default,
   100 					'url'   => $this->setting->default,
    99 					'type'  => $type,
   101 					'type'  => $type,
   100 					'icon'  => wp_mime_type_icon( $type ),
   102 					'icon'  => wp_mime_type_icon( $type, '.svg' ),
   101 					'title' => wp_basename( $this->setting->default ),
   103 					'title' => wp_basename( $this->setting->default ),
   102 				);
   104 				);
   103 
   105 
   104 				if ( 'image' === $type ) {
   106 				if ( 'image' === $type ) {
   105 					$default_attachment['sizes'] = array(
   107 					$default_attachment['sizes'] = array(
   241 					'frame_button' => __( 'Choose audio' ),
   243 					'frame_button' => __( 'Choose audio' ),
   242 				);
   244 				);
   243 			case 'image':
   245 			case 'image':
   244 				return array(
   246 				return array(
   245 					'select'       => __( 'Select image' ),
   247 					'select'       => __( 'Select image' ),
   246 					'site_icon'    => __( 'Select site icon' ),
   248 					'site_icon'    => __( 'Select Site Icon' ),
   247 					'change'       => __( 'Change image' ),
   249 					'change'       => __( 'Change image' ),
   248 					'default'      => __( 'Default' ),
   250 					'default'      => __( 'Default' ),
   249 					'remove'       => __( 'Remove' ),
   251 					'remove'       => __( 'Remove' ),
   250 					'placeholder'  => __( 'No image selected' ),
   252 					'placeholder'  => __( 'No image selected' ),
   251 					'frame_title'  => __( 'Select image' ),
   253 					'frame_title'  => __( 'Select image' ),