Make WordPress Core

Ticket #29013: 29013.3.diff

File 29013.3.diff, 563 bytes (added by ericmann, 11 years ago)

As an alternative, let's just be sure all ID3 tags are printed to JS, even if they're empty. This removes the burden of checking against undefined out of the JS templates (since logic should be abstracted from templates anyway).

  • src/wp-includes/media.php

     
    27252725
    27262726                $response['meta'] = array();
    27272727                foreach ( wp_get_attachment_id3_keys( $attachment, 'js' ) as $key => $label ) {
     2728                        // Start with an empty element so that, even if the tag is empty, we still output something
     2729                        $response['meta'][ $key ] = '';
     2730
    27282731                        if ( ! empty( $meta[ $key ] ) ) {
    27292732                                $response['meta'][ $key ] = $meta[ $key ];
    27302733                        }