<?php
// $block are injected by the core ACF
$data = $block['data'] ?? null;

if ( $data ) {
	$cta         = ! empty( $data['tagmailer-form-cta'] ) ? $data['tagmailer-form-cta'] : '';
	$containerid = ! empty( $data['tagmailer-form-containerid'] ) ? $data['tagmailer-form-containerid'] : '';

	// Sanitize the values
	$cta         = sanitize_text_field( $cta );
	$containerid = sanitize_text_field( $containerid );

	echo do_shortcode( "[tagmailer_form cta=\"{$cta}\" containerid=\"{$containerid}\"]" );
}
