<?php

namespace Saswp;

function property_title_shortcode() {
	$settings    = new \Saswp\Settings();
	$property    = new \Saswp\Repository\PropertyRepository();
	$propertyDTO = $property->get( $settings->get( 'sas_one_property_page_id' ) )->getProperty();
	if ( $propertyDTO->id && isset( $propertyDTO->name ) ) {
		return '<div><h1 class="title">' . esc_html( $propertyDTO->name ) . '</h1></div>';
	}

	return '<div class="property-title" data-shortcode="property_title"></div>';
}

?>
