Definition:
function media_upload_type_form($type = 'file', $errors = null, $id = null) {}
Parameters
- unknown_type $type
- unknown_type $errors
- unknown_type $id
Defined filters
- media_upload_form_url
apply_filters('media_upload_form_url', $form_action_url, $type)
Source code
function media_upload_type_form($type = 'file', $errors = null, $id = null) {
media_upload_header();
$post_id = isset( $_REQUEST['post_id'] )? intval( $_REQUEST['post_id'] ) : 0;
$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
?>
<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form">
<?php submit_button( '', 'hidden', 'save', false ); ?>
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
<?php wp_nonce_field('media-form'); ?>
<h3 class="media-title"><?php _e('Add media files from your computer'); ?></h3>
<?php media_upload_form( $errors ); ?>
<script type="text/javascript">
//<![CDATA[
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 0 ) {
preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
}
updateMediaForm();
});
//]]>
</script>
<div id="media-items">
<?php
if ( $id ) {
if ( !is_wp_error($id) ) {
add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
echo get_media_items( $id, $errors );
} else {
echo '<div id="media-upload-error">'.esc_html($id->get_error_message()).'</div>';
exit;
}
}
?>
</div>
<p class="savebutton ml-submit">
<?php submit_button( __( 'Save all changes' ), 'button', 'save', false ); ?>
</p>
</form>
<?php
}
2389

February 12, 2011 


No comments yet... Be the first to leave a reply!