Introduce API to add back the description field in the new media popup.
Props nacin fixes #22642 git-svn-id: https://develop.svn.wordpress.org/trunk@22929 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a792f59b19
commit
cdce6a366e
@ -1899,6 +1899,10 @@ function wp_ajax_save_attachment_compat() {
|
||||
if ( 'attachment' != $post['post_type'] )
|
||||
wp_send_json_error();
|
||||
|
||||
// Handle the description field automatically, if a plugin adds it back.
|
||||
if ( isset( $attachment_data['post_content'] ) )
|
||||
$post['post_content'] = $attachment_data['post_content'];
|
||||
|
||||
$post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data );
|
||||
|
||||
if ( isset( $post['errors'] ) ) {
|
||||
|
@ -1287,6 +1287,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) {
|
||||
$default_args = array(
|
||||
'errors' => null,
|
||||
'taxonomies' => false,
|
||||
'description' => false,
|
||||
);
|
||||
|
||||
$args = wp_parse_args( $args, $default_args );
|
||||
@ -1325,9 +1326,12 @@ function get_compat_media_markup( $attachment_id, $args = null ) {
|
||||
$form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
|
||||
|
||||
unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'],
|
||||
$form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'],
|
||||
$form_fields['post_title'], $form_fields['post_excerpt'],
|
||||
$form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] );
|
||||
|
||||
if ( ! $args['description'] )
|
||||
unset( $form_fields['post_content'] );
|
||||
|
||||
$media_meta = apply_filters( 'media_meta', '', $post );
|
||||
|
||||
$defaults = array(
|
||||
|
@ -1388,7 +1388,7 @@ function wp_prepare_attachment_for_js( $attachment ) {
|
||||
}
|
||||
|
||||
if ( function_exists('get_compat_media_markup') )
|
||||
$response['compat'] = get_compat_media_markup( $attachment->ID, array( 'taxonomies' => true ) );
|
||||
$response['compat'] = get_compat_media_markup( $attachment->ID, array( 'taxonomies' => true, 'description' => true ) );
|
||||
|
||||
return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user