Tribe_Meta_Box::show_field_file( $field,  $meta )


Source

File: lib/tribe-meta-box.php

	public function show_field_file( $field, $meta ) {
		global $post;

		if ( ! is_array( $meta ) ) {
			$meta = (array) $meta;
		}

		$this->show_field_begin( $field, $meta );
		if ( isset( $field['desc'] ) ) {
			echo "<p class='description'>{$field['desc']}</p>";
		}

		if ( ! empty( $meta ) ) {
			$nonce = wp_create_nonce( 'tribe_ajax_delete' );
			echo '<div style="margin-bottom: 10px"><strong>' . esc_html__( 'Uploaded files', 'advanced-post-manager' ) . '</strong></div>';
			echo '<ol class="tribe-upload">';
			foreach ( $meta as $att ) {
				echo '<li>' . wp_get_attachment_link( $att, '', false, false, ' ' ) . " (<a class='tribe-delete-file' href='#' rel='$nonce|{$post->ID}|{$field['meta']}|$att'>" . esc_html__( 'Delete', 'advanced-post-manager' ) . '</a>)</li>';
			}
			echo '</ol>';
		}

		// show form upload
		echo '<div style="clear: both"><strong>' . esc_html__( 'Upload new files', 'advanced-post-manager' ) . "</strong></div>
			<div class='new-files'>
				<div class='file-input'><input type='file' name='{$field['meta']}[]' /></div>
				<a class='tribe-add-file' href='#'>" . esc_html__( 'Add another file', 'advanced-post-manager' ) . '</a>
			</div>
		</td>';
	}