From 41697f39108b0bac843560e7796ca5b2c767f40f Mon Sep 17 00:00:00 2001
From: Ryan Boren
Date: Mon, 5 Nov 2012 14:04:22 +0000
Subject: [PATCH] Attachment editor improvements. Put the non-editable metadata
into the submit/publish box.
Props helenyhou
see #21391
git-svn-id: https://develop.svn.wordpress.org/trunk@22364 602fd350-edb4-49c9-b593-d223f7449a82
---
wp-admin/css/wp-admin.css | 2 +-
wp-admin/edit-form-advanced.php | 2 +-
wp-admin/includes/media.php | 64 +++++++++++++++++++++++++-------
wp-admin/includes/meta-boxes.php | 12 +-----
4 files changed, 54 insertions(+), 26 deletions(-)
diff --git a/wp-admin/css/wp-admin.css b/wp-admin/css/wp-admin.css
index ebb78cc491..88422360f5 100644
--- a/wp-admin/css/wp-admin.css
+++ b/wp-admin/css/wp-admin.css
@@ -5826,7 +5826,7 @@ table.form-table td .updated {
padding: 0;
}
-#poststuff .postarea {
+#post-body-content {
margin-bottom: 20px;
}
diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index 91abc1eeaf..d4aa61867f 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -111,7 +111,7 @@ if ( 'attachment' == $post_type ) {
wp_enqueue_script( 'image-edit' );
wp_enqueue_style( 'imgareaselect' );
add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' );
- add_meta_box( 'attachmentdata', __('Attachment Page Content'), 'attachment_data_meta_box', null, 'normal', 'core' );
+ add_meta_box( 'attachmentdata', __('Attachment Page Content'), 'attachment_content_meta_box', null, 'normal', 'core' );
add_action( 'edit_form_after_title', 'edit_form_image_editor' );
} else {
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core' );
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index 97aea01289..0adf06d50d 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -2122,6 +2122,7 @@ function edit_form_image_editor() {
$filename = esc_html( basename( $post->guid ) );
$title = esc_attr( $post->post_title );
+ $alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
$post_mime_types = get_post_mime_types();
$keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) );
@@ -2151,22 +2152,57 @@ function edit_form_image_editor() {
+
-
-
-
-
-
-
- post_mime_type; ?>
- ' . __( 'Dimensions:' ) . ' ' . $media_dims;
- ?>
-
-
+
guid ) );
+
+ $media_dims = '';
+ $meta = wp_get_attachment_metadata( $post->ID );
+ if ( is_array( $meta ) && array_key_exists( 'width', $meta ) && array_key_exists( 'height', $meta ) )
+ $media_dims .= "{$meta['width']} × {$meta['height']} ";
+ $media_dims = apply_filters( 'media_meta', $media_dims, $post );
+
+ $att_url = wp_get_attachment_url( $post->ID );
+?>
+
+
+
+
+
+
+
+
+ post_mime_type; ?>
+
+
+
+
+
+
+ID, '_wp_attachment_image_alt', true );
+function attachment_content_meta_box( $post ) {
$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' );
$editor_args = array(
'textarea_name' => 'content',
@@ -317,15 +316,6 @@ function attachment_data_meta_box( $post ) {
post_content, 'attachment_content', $editor_args ); ?>
-
-
-
-
-
-
-
-
-