Changeset 21009 for trunk/wp-admin/custom-background.php
- Timestamp:
- 06/06/2012 04:48:53 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/custom-background.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/custom-background.php
r20966 r21009 73 73 add_action("load-$page", array(&$this, 'take_action'), 49); 74 74 add_action("load-$page", array(&$this, 'handle_upload'), 49); 75 add_filter( 'attachment_fields_to_edit', array( $this, 'attachment_fields_to_edit' ), 10, 2 ); 76 add_filter( 'media_upload_tabs', array( $this, 'filter_upload_tabs' ) ); 75 76 if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-background' ) { 77 add_filter( 'attachment_fields_to_edit', array( $this, 'attachment_fields_to_edit' ), 10, 2 ); 78 add_filter( 'media_upload_tabs', array( $this, 'filter_upload_tabs' ) ); 79 add_filter( 'media_upload_mime_type_links', '__return_empty_array' ); 80 } 77 81 78 82 if ( $this->admin_header_callback ) … … 389 393 } 390 394 395 /** 396 * Replace default attachment actions with "Set as background" link. 397 * 398 * @since 3.4.0 399 */ 391 400 function attachment_fields_to_edit( $form_fields, $post ) { 392 if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-background' ) { 393 $form_fields = array( 'image-size' => $form_fields['image-size'] ); 394 $form_fields['buttons'] = array( 'tr' => '<tr class="submit"><td></td><td><a data-attachment-id="' . $post->ID . '" class="wp-set-background">' . __( 'Set as background' ) . '</a></td></tr>' ); 395 $form_fields['context'] = array( 'input' => 'hidden', 'value' => 'custom-background' ); 396 } 401 $form_fields = array( 'image-size' => $form_fields['image-size'] ); 402 $form_fields['buttons'] = array( 'tr' => '<tr class="submit"><td></td><td><a data-attachment-id="' . $post->ID . '" class="wp-set-background">' . __( 'Set as background' ) . '</a></td></tr>' ); 403 $form_fields['context'] = array( 'input' => 'hidden', 'value' => 'custom-background' ); 397 404 398 405 return $form_fields; 399 406 } 400 407 401 function filter_upload_tabs ( $tabs ){ 402 if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-background' ) 403 return array( 'library' => __('Media Library') ); 404 405 return $tabs; 408 /** 409 * Leave only "Media Library" tab in the uploader window. 410 * 411 * @since 3.4.0 412 */ 413 function filter_upload_tabs() { 414 return array( 'library' => __('Media Library') ); 406 415 } 407 416
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)