Changeset 22673 for trunk/wp-admin/includes/media.php
- Timestamp:
- 11/19/2012 08:10:38 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/media.php
r22670 r22673 811 811 */ 812 812 function image_attachment_fields_to_edit($form_fields, $post) { 813 if ( substr($post->post_mime_type, 0, 5) == 'image' ) {814 $alt = get_post_meta($post->ID, '_wp_attachment_image_alt', true);815 if ( empty($alt) )816 $alt = '';817 818 $form_fields['post_title']['required'] = true;819 820 $form_fields['image_alt'] = array(821 'value' => $alt,822 'label' => __('Alternative Text'),823 'helps' => __('Alt text for the image, e.g. “The Mona Lisa”')824 );825 826 $form_fields['align'] = array(827 'label' => __('Alignment'),828 'input' => 'html',829 'html' => image_align_input_fields($post, get_option('image_default_align')),830 );831 832 $form_fields['image-size'] = image_size_input_fields( $post, get_option('image_default_size', 'medium') );833 834 } else {835 unset( $form_fields['image_alt'] );836 }837 813 return $form_fields; 838 814 } 839 840 add_filter('attachment_fields_to_edit', 'image_attachment_fields_to_edit', 10, 2);841 815 842 816 /** … … 1001 975 $form_fields = array_merge_recursive($form_fields, (array) $errors); 1002 976 977 // This was formerly in image_attachment_fields_to_edit(). 978 if ( substr($post->post_mime_type, 0, 5) == 'image' ) { 979 $alt = get_post_meta($post->ID, '_wp_attachment_image_alt', true); 980 if ( empty($alt) ) 981 $alt = ''; 982 983 $form_fields['post_title']['required'] = true; 984 985 $form_fields['image_alt'] = array( 986 'value' => $alt, 987 'label' => __('Alternative Text'), 988 'helps' => __('Alt text for the image, e.g. “The Mona Lisa”') 989 ); 990 991 $form_fields['align'] = array( 992 'label' => __('Alignment'), 993 'input' => 'html', 994 'html' => image_align_input_fields($post, get_option('image_default_align')), 995 ); 996 997 $form_fields['image-size'] = image_size_input_fields( $post, get_option('image_default_size', 'medium') ); 998 999 } else { 1000 unset( $form_fields['image_alt'] ); 1001 } 1002 1003 return $form_fields; 1004 1003 1005 $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post); 1004 1006
Note: See TracChangeset
for help on using the changeset viewer.