src/properties/class-papi-property-module.php
public function html() {
		$layout             = $this->get_setting( 'layout' );
		$post_type          = $this->get_post_type();
		$settings           = $this->get_settings();
		$value              = $this->get_value();
		$posts              = $this->get_posts( $post_type );
		$selected_post_id   = is_object( $value ) ? $value->module : 0;
		$selected_post_id   = is_object( $selected_post_id ) ? $selected_post_id->ID : 0;
		$templates          = $this->get_templates( $selected_post_id );
		$selected_template  = is_object( $value ) ? intval( $value->template ) : null;
		$classes            = '';

		if ( $settings->select2 ) {
			$classes .= ' papi-component-select2';
		}
		?>

		<div class="papi-property-module papi-property-post advanced">
			<table class="papi-table">
				<tr>
					<td>
						<label for="<?php echo esc_attr( $this->html_id() ); ?>_modules">
							<?php echo esc_html( $settings->labels['select_module'] ); ?>
						</label>
					</td>
					<td>

						<?php
							$placeholder = ! is_null( $settings->placeholder ) ? $settings->placeholder : '';
						?>

						<select
							class="<?php echo esc_attr( $classes ); ?>  papi-property-module-right"
							id="<?php echo esc_attr( $this->html_id() ); ?>_modules"
							name="<?php echo esc_attr( $this->html_name() ); ?>"
							data-allow-clear="<?php echo empty( $settings->placeholder ) ? 'false' : 'true'; ?>"
							data-select-item="<?php echo esc_attr( $settings->labels['select_module'] ); ?>"
							data-placeholder="<?php echo esc_attr( $settings->placeholder ); ?>"
							data-width="100%"
							>

							<?php if ( ! empty( $settings->placeholder ) ): ?>
								<?php if ( $settings->new_url ): ?>
									<option data-placeholder data-new-url="<?php echo esc_attr( admin_url( 'post-new.php?post_type=' . $post_type ) ); ?>"></option>
								<?php else: ?>
									<option></option>
								<?php endif; ?>
							<?php endif; ?>

							<?php
							foreach ( $posts as $post ) {
								if ( papi_is_empty( $post->post_title ) ) {
									continue;
								}

								papi_render_html_tag( 'option', [
									'data-entry-type' => get_post_meta( $post->ID, papi_get_page_type_key(), true ),
									'data-edit-url'   => get_edit_post_link( $value ),
									'data-new-url'    => $settings->new_url ? admin_url( 'post-new.php?post_type=' . $post->post_type ) : '',
									'selected'        => $selected_post_id === $post->ID,
									'value'           => $post->ID,
									$post->post_title
								] );
							}
							?>
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label for="<?php echo esc_attr( $this->html_id() ); ?>_template">
							<?php echo esc_html( $settings->labels['select_template'] ); ?>
						</label>
					</td>
					<td>
						<select
							id="<?php echo esc_attr( $this->html_id() ); ?>_template"
							name="<?php echo esc_attr( $this->html_name() ); ?>_template"
							class="<?php echo esc_attr( $classes ); ?> papi-property-module-left"
							data-post-query='<?php echo esc_attr( papi_maybe_json_encode( $settings->query ) ); ?>'
							data-width="100%"
							>
							<?php
							foreach ( $templates as $index => $item ) {
								// Make string to a array.
								if ( is_string( $item ) ) {
									$item = [
										'label'    => $item,
										'template' => $item,
										'default'  => false
									];
								}

								// Bail if no array.
								if ( ! is_array( $item ) ) {
									continue;
								}

								// Bail if no label or template exists.
								if ( ! isset( $item['label'], $item['template'] ) ) {
									continue;
								}

								// Set missing default value.
								if ( ! isset( $item['default'] ) ) {
									$item['default'] = false;
								}

								papi_render_html_tag( 'option', [
									'value'    => $index,
									'selected' => ! papi_is_empty( $selected_template ) ? $index === $selected_template : $item['default'],
									$item['label']
								] );
							}
							?>
						</select>
					</td>
				</tr>
			</table>
		</div>
		<?php
	}
public function html() {
		$layout             = $this->get_setting( 'layout' );
		$post_type          = $this->get_post_type();
		$settings           = $this->get_settings();
		$value              = $this->get_value();
		$posts              = $this->get_posts( $post_type );
		$selected_post_id   = is_object( $value ) ? $value->module : 0;
		$selected_post_id   = is_object( $selected_post_id ) ? $selected_post_id->ID : 0;
		$templates          = $this->get_templates( $selected_post_id );
		$selected_template  = is_object( $value ) ? intval( $value->template ) : null;
		$classes            = '';

		if ( $settings->select2 ) {
			$classes .= ' papi-component-select2';
		}
		?>

		<div class="papi-property-module papi-property-post advanced">
			<table class="papi-table">
				<tr>
					<td>
						<label for="<?php echo esc_attr( $this->html_id() ); ?>_modules">
							<?php echo esc_html( $settings->labels['select_module'] ); ?>
						</label>
					</td>
					<td>

						<?php
							$placeholder = ! is_null( $settings->placeholder ) ? $settings->placeholder : '';
						?>

						<select
							class="<?php echo esc_attr( $classes ); ?>  papi-property-module-right"
							id="<?php echo esc_attr( $this->html_id() ); ?>_modules"
							name="<?php echo esc_attr( $this->html_name() ); ?>"
							data-allow-clear="<?php echo empty( $settings->placeholder ) ? 'false' : 'true'; ?>"
							data-select-item="<?php echo esc_attr( $settings->labels['select_module'] ); ?>"
							data-placeholder="<?php echo esc_attr( $settings->placeholder ); ?>"
							data-width="100%"
							>

							<?php if ( ! empty( $settings->placeholder ) ): ?>
								<?php if ( $settings->new_url ): ?>
									<option data-placeholder data-new-url="<?php echo esc_attr( admin_url( 'post-new.php?post_type=' . $post_type ) ); ?>"></option>
								<?php else: ?>
									<option></option>
								<?php endif; ?>
							<?php endif; ?>

							<?php
							foreach ( $posts as $post ) {
								if ( papi_is_empty( $post->post_title ) ) {
									continue;
								}

								papi_render_html_tag( 'option', [
									'data-entry-type' => get_post_meta( $post->ID, papi_get_page_type_key(), true ),
									'data-edit-url'   => get_edit_post_link( $value ),
									'data-new-url'    => $settings->new_url ? admin_url( 'post-new.php?post_type=' . $post->post_type ) : '',
									'selected'        => $selected_post_id === $post->ID,
									'value'           => $post->ID,
									$post->post_title
								] );
							}
							?>
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label for="<?php echo esc_attr( $this->html_id() ); ?>_template">
							<?php echo esc_html( $settings->labels['select_template'] ); ?>
						</label>
					</td>
					<td>
						<select
							id="<?php echo esc_attr( $this->html_id() ); ?>_template"
							name="<?php echo esc_attr( $this->html_name() ); ?>_template"
							class="<?php echo esc_attr( $classes ); ?> papi-property-module-left"
							data-post-query='<?php echo esc_attr( papi_maybe_json_encode( $settings->query ) ); ?>'
							data-width="100%"
							>
							<?php
							foreach ( $templates as $index => $item ) {
								// Make string to a array.
								if ( is_string( $item ) ) {
									$item = [
										'label'    => $item,
										'template' => $item,
										'default'  => false
									];
								}

								// Bail if no array.
								if ( ! is_array( $item ) ) {
									continue;
								}

								// Bail if no label or template exists.
								if ( ! isset( $item['label'], $item['template'] ) ) {
									continue;
								}

								// Set missing default value.
								if ( ! isset( $item['default'] ) ) {
									$item['default'] = false;
								}

								papi_render_html_tag( 'option', [
									'value'    => $index,
									'selected' => ! papi_is_empty( $selected_template ) ? $index === $selected_template : $item['default'],
									$item['label']
								] );
							}
							?>
						</select>
					</td>
				</tr>
			</table>
		</div>
		<?php
	}
Render property html.