Retrieve HTML form for modifying the image attachment.

Signature

get_media_item( $attachment_id, $args = null )
attachment_id
 (int) Attachment ID for modification.
args
 (string|array) Optional. Override defaults.
Default: null

Return

(string) HTML form for attachment.

Source

function get_media_item( $attachment_id, $args = null ) {
	global $redir_tab;

	if ( ( $attachment_id = intval( $attachment_id ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) )
		$thumb_url = $thumb_url[0];
	else
		$thumb_url = false;

	$post = get_post( $attachment_id );
	$current_post_id = !empty( $_GET['post_id'] ) ? (int) $_GET['post_id'] : 0;

	$default_args = array(
		'errors' => null,
		'send' => $current_post_id ? post_type_supports( get_post_type( $current_post_id ), 'editor' ) : true,
		'delete' => true,
		'toggle' => true,
		'show_title' => true
	);
	$args = wp_parse_args( $args, $default_args );

220 more lines...
WP Trac GitHub

Link here