Tribe_Meta_Box::show_field_post2post( $field,  $meta )


Source

File: lib/tribe-meta-box.php

	public function show_field_post2post( $field, $meta ) {
		$this->show_field_begin( $field, $meta );
		if ( ! isset( $field['dropdown_title'] ) ) {
			$post_type_object = get_post_type_object( $field['post_type'] );
			$field['dropdown_title'] = sprintf( 'Select %s', $post_type_object->labels->singular_name );
		}

		$this->dropdown_posts( array(
			'post_type' => $field['post_type'],
			'show_option_none' => $field['dropdown_title'],
			'name' => $field['meta'],
			'class' => 'p2p-drop',
		) );

		$list_items = '';
		$list_item_template = '<li><label><input type="checkbox" name="'.$field['meta'].'[]" value="%s" checked="checked" /> %s</label></li>';
		if ( ! empty( $meta ) ) {
			foreach ( (array) $meta as $post_id ) {
				$p = get_post( $post_id );
				$list_items .= sprintf( $list_item_template, $p->ID, $p->post_title );
			}
		}

		echo '<ul class="p2p-connected">' . $list_items . '</ul>';
		$this->show_field_end( $field, $meta );
	}