Tribe_Meta_Box::insert_images()
Source
File: lib/tribe-meta-box.php
public function insert_images() { if ( ! isset( $_POST['tribe-insert'] ) || empty( $_POST['attachments'] ) ){ return; } check_admin_referer( 'media-form' ); $nonce = wp_create_nonce( 'tribe_ajax_delete' ); $post_id = $_POST['post_id']; $id = $_POST['field_id']; // modify the insertion string $html = ''; foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { $attachment = stripslashes_deep( $attachment ); if ( empty( $attachment['selected'] ) || empty( $attachment['url'] ) ) { continue; } $li = "<li id='item_$attachment_id'>"; $li .= "<img src='{$attachment['url']}' />"; $li .= "<a title='" . __( 'Delete this image', 'advanced-post-manager' ) . "' class='tribe-delete-file' href='#' rel='$nonce|$post_id|$id|$attachment_id'>" . __( 'Delete', 'advanced-post-manager' ) . '</a>'; $li .= "<input type='hidden' name='{$id}[]' value='$attachment_id' />"; $li .= '</li>'; $html .= $li; } media_send_to_editor( $html ); }