Ticket #9267: show_url_in_media_library.patch
| File show_url_in_media_library.patch, 2.8 KB (added by , 17 years ago) |
|---|
-
wp-admin/async-upload.php
30 30 add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2); 31 31 echo get_media_item($id, array( 'send' => false, 'delete' => false )); 32 32 } else { 33 add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2); 33 34 echo get_media_item($id); 34 35 } 35 36 exit; -
wp-admin/includes/media.php
838 838 function image_attachment_fields_to_edit($form_fields, $post) { 839 839 if ( substr($post->post_mime_type, 0, 5) == 'image' ) { 840 840 $form_fields['post_title']['required'] = true; 841 $file = wp_get_attachment_url($post->ID); 841 842 843 $form_fields['image_url']['value'] = $file; 844 842 845 $form_fields['post_excerpt']['label'] = __('Caption'); 843 846 $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image'); 844 847 … … 871 874 return $form_fields; 872 875 } 873 876 877 function media_post_single_attachment_fields_to_edit( $form_fields, $post ) { 878 unset($form_fields['image_url']); 879 return $form_fields; 880 } 881 882 874 883 /** 875 884 * {@internal Missing Short Description}} 876 885 * … … 943 952 if ( is_array($post) ) 944 953 $post = (object) $post; 945 954 955 $image_url = wp_get_attachment_url($post->ID); 956 957 946 958 $edit_post = sanitize_post($post, 'edit'); 947 959 948 960 $form_fields = array( 961 'image_url' => array( 962 'label' => __('File URL'), 963 'input' => 'html', 964 'html' => "<input type='text' class='urlfield' readonly='readonly' name='attachments[$post->ID][url]' value='" . attribute_escape($image_url) . "' /><br />", 965 'value' => $edit_post->post_url, 966 ), 949 967 'post_title' => array( 950 968 'label' => __('Title'), 951 969 'value' => $edit_post->post_title, … … 1371 1389 <?php 1372 1390 if ( $id ) { 1373 1391 if ( !is_wp_error($id) ) { 1392 add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2); 1374 1393 echo get_media_items( $id, $errors ); 1375 1394 } else { 1376 1395 echo '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>'; … … 1537 1556 </tr></thead> 1538 1557 </table> 1539 1558 <div id="media-items"> 1559 <?php add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2); ?> 1540 1560 <?php echo get_media_items($post_id, $errors); ?> 1541 1561 </div> 1542 1562 … … 1770 1790 </script> 1771 1791 1772 1792 <div id="media-items"> 1793 <?php add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2); ?> 1773 1794 <?php echo get_media_items(null, $errors); ?> 1774 1795 </div> 1775 1796 <p class="ml-submit">