src/properties/class-papi-property-relationship.php
public function html() {
		$post_id       = papi_get_post_id();
		$slug          = $this->html_name();
		$settings      = $this->get_settings();
		$settings_json = [];
		$sort_option   = $this->get_sort_option( $post_id );
		$sort_options  = static::get_sort_options();
		$values        = papi_get_only_objects( $this->get_value() );
		$items         = $this->get_items( $settings );


		if ( papi_is_empty( $settings->items ) ) {
			$values = array_map( [$this, 'convert_post_to_item'], $values );
		} else {
			foreach ( array_keys( $sort_options ) as $key ) {
				if ( strpos( $key, 'Post' ) === 0 ) {
					unset( $sort_options[$key] );
				}
			}
		}

		// Remove existing values if `only once` is active.
		if ( $this->get_setting( 'only_once' ) ) {
			$items = array_udiff( $items, $values, function( $a, $b ) {
				// Backwards compatibility with both `post_title` and `title`.
				return strcmp(
					strtolower( isset( $a->post_title ) ? $a->post_title : $a->title ),
					strtolower( isset( $b->post_title ) ? $b->post_title : $b->title )
				);
			} );
		}

		// Convert all sneak case key to camel case.
		foreach ( (array) $settings as $key => $val ) {
			if ( ! is_string( $key ) || ! in_array( $key, ['only_once', 'limit'], true ) ) {
				continue;
			}

			if ( $key = papi_camel_case( $key ) ) {
				$settings_json[$key] = $val;
			}
		}
		?>
		<div class="papi-property-relationship" data-settings='<?php echo esc_attr( papi_maybe_json_encode( $settings_json ) ); ?>'>
			<input type="hidden" name="<?php echo esc_attr( $slug ); ?>[]" data-papi-rule="<?php echo esc_attr( $slug ); ?>" />
			<div class="relationship-inner">
				<div class="relationship-top-left">
					<label for="<?php echo esc_attr( $this->html_id( 'search' ) ); ?>"><?php esc_html_e( 'Search', 'papi' ); ?></label>
					<input id="<?php echo esc_attr( $this->html_id( 'search' ) ); ?>" type="search" />
				</div>
				<div class="relationship-top-right">
					<?php if ( $settings->show_sort_by ): ?>
						<label for="<?php echo esc_attr( $this->html_id( 'sort_option' ) ); ?>"><?php esc_html_e( 'Sort by', 'papi' ); ?></label>
						<select id="<?php echo esc_attr( $this->html_id( 'sort_option' ) ); ?>" name="<?php echo esc_attr( $this->html_id( 'sort_option' ) ); ?>">
							<?php foreach ( array_keys( $sort_options ) as $key ): ?>
								<option value="<?php echo esc_attr( $key ); ?>" <?php echo $key === $sort_option ? 'selected="selected"' : ''; ?>><?php echo esc_html( $key ); ?></option>
							<?php endforeach; ?>
						</select>
					<?php endif; ?>
				</div>
				<div class="papi-clear"></div>
			</div>
			<div class="relationship-inner">
				<div class="relationship-left">
					<ul>
						<?php
						foreach ( $items as $item ):
							if ( ! empty( $item->title ) ):
								?>
								<li>
									<input type="hidden" data-name="<?php echo esc_attr( $slug ); ?>[]" value="<?php echo esc_attr( $item->id ); ?>"/>
									<a href="#" title="<?php echo esc_attr( $item->title ); ?>"><?php echo esc_html( $item->title ); ?></a>
									<span class="icon plus"></span>
								</li>
							<?php
							endif;
						endforeach;
						?>
					</ul>
				</div>
				<div class="relationship-right">
					<ul>
						<?php foreach ( $values as $item ): ?>
							<li>
								<input type="hidden" name="<?php echo esc_attr( $slug ); ?>[]" value="<?php echo esc_attr( $item->id ); ?>"/>
								<a href="#"><?php echo esc_attr( $item->title ); ?></a>
								<span class="icon minus"></span>
							</li>
						<?php endforeach; ?>
					</ul>
				</div>
				<div class="papi-clear"></div>
			</div>
		</div>
	<?php
	}
public function html() {
		$post_id       = papi_get_post_id();
		$slug          = $this->html_name();
		$settings      = $this->get_settings();
		$settings_json = [];
		$sort_option   = $this->get_sort_option( $post_id );
		$sort_options  = static::get_sort_options();
		$values        = papi_get_only_objects( $this->get_value() );
		$items         = $this->get_items( $settings );


		if ( papi_is_empty( $settings->items ) ) {
			$values = array_map( [$this, 'convert_post_to_item'], $values );
		} else {
			foreach ( array_keys( $sort_options ) as $key ) {
				if ( strpos( $key, 'Post' ) === 0 ) {
					unset( $sort_options[$key] );
				}
			}
		}

		// Remove existing values if `only once` is active.
		if ( $this->get_setting( 'only_once' ) ) {
			$items = array_udiff( $items, $values, function( $a, $b ) {
				// Backwards compatibility with both `post_title` and `title`.
				return strcmp(
					strtolower( isset( $a->post_title ) ? $a->post_title : $a->title ),
					strtolower( isset( $b->post_title ) ? $b->post_title : $b->title )
				);
			} );
		}

		// Convert all sneak case key to camel case.
		foreach ( (array) $settings as $key => $val ) {
			if ( ! is_string( $key ) || ! in_array( $key, ['only_once', 'limit'], true ) ) {
				continue;
			}

			if ( $key = papi_camel_case( $key ) ) {
				$settings_json[$key] = $val;
			}
		}
		?>
		<div class="papi-property-relationship" data-settings='<?php echo esc_attr( papi_maybe_json_encode( $settings_json ) ); ?>'>
			<input type="hidden" name="<?php echo esc_attr( $slug ); ?>[]" data-papi-rule="<?php echo esc_attr( $slug ); ?>" />
			<div class="relationship-inner">
				<div class="relationship-top-left">
					<label for="<?php echo esc_attr( $this->html_id( 'search' ) ); ?>"><?php esc_html_e( 'Search', 'papi' ); ?></label>
					<input id="<?php echo esc_attr( $this->html_id( 'search' ) ); ?>" type="search" />
				</div>
				<div class="relationship-top-right">
					<?php if ( $settings->show_sort_by ): ?>
						<label for="<?php echo esc_attr( $this->html_id( 'sort_option' ) ); ?>"><?php esc_html_e( 'Sort by', 'papi' ); ?></label>
						<select id="<?php echo esc_attr( $this->html_id( 'sort_option' ) ); ?>" name="<?php echo esc_attr( $this->html_id( 'sort_option' ) ); ?>">
							<?php foreach ( array_keys( $sort_options ) as $key ): ?>
								<option value="<?php echo esc_attr( $key ); ?>" <?php echo $key === $sort_option ? 'selected="selected"' : ''; ?>><?php echo esc_html( $key ); ?></option>
							<?php endforeach; ?>
						</select>
					<?php endif; ?>
				</div>
				<div class="papi-clear"></div>
			</div>
			<div class="relationship-inner">
				<div class="relationship-left">
					<ul>
						<?php
						foreach ( $items as $item ):
							if ( ! empty( $item->title ) ):
								?>
								<li>
									<input type="hidden" data-name="<?php echo esc_attr( $slug ); ?>[]" value="<?php echo esc_attr( $item->id ); ?>"/>
									<a href="#" title="<?php echo esc_attr( $item->title ); ?>"><?php echo esc_html( $item->title ); ?></a>
									<span class="icon plus"></span>
								</li>
							<?php
							endif;
						endforeach;
						?>
					</ul>
				</div>
				<div class="relationship-right">
					<ul>
						<?php foreach ( $values as $item ): ?>
							<li>
								<input type="hidden" name="<?php echo esc_attr( $slug ); ?>[]" value="<?php echo esc_attr( $item->id ); ?>"/>
								<a href="#"><?php echo esc_attr( $item->title ); ?></a>
								<span class="icon minus"></span>
							</li>
						<?php endforeach; ?>
					</ul>
				</div>
				<div class="papi-clear"></div>
			</div>
		</div>
	<?php
	}
Render property html.