<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
 * Server-side render callback for the SimplyConf Register block.
 *
 * @param array    $attributes Block attributes.
 * @param string   $content    Block content.
 * @param WP_Block $block      Block instance.
 * @return string Rendered block HTML.
 */

$event_id   = isset($attributes['eventId']) ? intval($attributes['eventId']) : 1;
$hide_title = isset($attributes['hideTitle']) ? (bool) $attributes['hideTitle'] : false;

if (class_exists('SimplyConf_Frontend_Dashboard')) {
	$instance = new SimplyConf_Frontend_Dashboard();
	// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is generated by SimplyConf_Frontend_Dashboard::render_register() which handles its own escaping.
	echo $instance->render_register( $event_id, $hide_title );
} else {
	echo '<p>' . esc_html__('SimplyConf Registration is not available.', 'simplyconf') . '</p>';
}
