Make WordPress Core

Changeset 28837


Ignore:
Timestamp:
06/26/2014 01:04:32 AM (10 years ago)
Author:
wonderboymusic
Message:

In media_buttons(), add a static var $instance to increment the id attribute of insert-media-button-%d on each call.

Props ericlewis.
Fixes #28090.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-advanced.php

    r28051 r28837  
    489489    'dfw' => true,
    490490    'drag_drop_upload' => true,
    491     'tabfocus_elements' => 'insert-media-button,save-post',
     491    'tabfocus_elements' => 'insert-media-button-1,save-post',
    492492    'editor_height' => 360,
    493493    'tinymce' => array(
  • trunk/src/wp-admin/includes/media.php

    r28632 r28837  
    515515 */
    516516function media_buttons($editor_id = 'content') {
     517    static $instance = 0;
     518    $instance++;
     519
    517520    $post = get_post();
    518521    if ( ! $post && ! empty( $GLOBALS['post_ID'] ) )
     
    525528    $img = '<span class="wp-media-buttons-icon"></span> ';
    526529
    527     echo '<a href="#" id="insert-media-button" class="button insert-media add_media" data-editor="' . esc_attr( $editor_id ) . '" title="' . esc_attr__( 'Add Media' ) . '">' . $img . __( 'Add Media' ) . '</a>';
    528 
     530    printf( '<a href="#" id="insert-media-button-%d" class="button insert-media add_media" data-editor="%s" title="%s">%s</a>',
     531        $instance,
     532        esc_attr( $editor_id ),
     533        esc_attr__( 'Add Media' ),
     534        $img . __( 'Add Media' )
     535    );
    529536    /**
    530537     * Filter the legacy (pre-3.5.0) media buttons.
Note: See TracChangeset for help on using the changeset viewer.