Files
CWC/views/blocks/contact-info/contact-info.php
T

67 lines
2.4 KiB
PHP

<?php
/**
* Block Name: Contact Info
*
* Two-column contact page layout: contact info, address/email/phone,
* and a Gravity Forms contact form on the left; Leaflet map placeholder
* on the right. Reads from the global `contact_info` option.
*
* @package CWC
*/
namespace CWC;
$info = get_field( 'contact_info', 'option' );
$address = $info['address'] ?? '';
$email = $info['email'] ?? '';
$phone = $info['phone'] ?? '';
$classes = 'contact-info';
$wrapper = blockWrapperAttributes( $classes, $is_preview );
?>
<section <?php echo wp_kses_post( $wrapper ); ?>>
<div class="contact-info__grid">
<div class="contact-info__details">
<h1 class="contact-info__heading">Contact</h1>
<ul class="contact-info__items">
<?php if ( $address ) : ?>
<li class="contact-info__item contact-info__item--address">
<span class="contact-info__icon" aria-hidden="true">
<img src="<?php echo esc_url( get_theme_file_uri( '/static/img/contact/icon-address.svg' ) ); ?>" alt="" width="24" height="24" loading="lazy" />
</span>
<span class="contact-info__value"><?php echo wp_kses_post( $address ); ?></span>
</li>
<?php endif; ?>
<?php if ( $email ) : ?>
<li class="contact-info__item contact-info__item--email">
<span class="contact-info__icon" aria-hidden="true">
<img src="<?php echo esc_url( get_theme_file_uri( '/static/img/contact/icon-email.svg' ) ); ?>" alt="" width="24" height="24" loading="lazy" />
</span>
<a class="contact-info__value" href="mailto:<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></a>
</li>
<?php endif; ?>
<?php if ( $phone ) : ?>
<li class="contact-info__item contact-info__item--phone">
<span class="contact-info__icon" aria-hidden="true">
<img src="<?php echo esc_url( get_theme_file_uri( '/static/img/contact/icon-phone.svg' ) ); ?>" alt="" width="24" height="24" loading="lazy" />
</span>
<a class="contact-info__value" href="tel:<?php echo esc_attr( $phone ); ?>"><?php echo esc_html( $phone ); ?></a>
</li>
<?php endif; ?>
</ul>
<div class="contact-info__form">
<?php echo do_shortcode( '[gravityform id="1" title="false" description="false" ajax="true"]' ); ?>
</div>
</div>
<div class="contact-info__map" id="contact-map" aria-label="Map of downtown Winnipeg" role="region">
<!-- Leaflet map will mount here. Pin: orange-01 + white map marker (TBD). -->
</div>
</div>
</section>