<?php
/**
 * Subtitle Block module.
 *
 * Provides a server-rendered Gutenberg block `bw-dev/subtitle` — an "eyebrow"
 * style line of uppercase letter-spaced text with optional alignment, custom
 * color, and link. Ported from the standalone `rg-subtitle` block in the
 * Regent Grand Kadence-child theme; the hardcoded brand color palette was
 * replaced with a custom ColorPicker so the block fits any client site.
 *
 * No persisted settings — the module's settings tab renders inline docs only.
 *
 * @package BW_Dev
 */

defined( 'ABSPATH' ) || exit;

class BW_Dev_Module_Subtitle implements BW_Dev_Module_Interface {

	public function slug(): string {
		return 'subtitle';
	}

	public function label(): string {
		return __( 'Subtitle Block', 'bw-dev' );
	}

	public function group(): string {
		return 'blocks';
	}

	public function default_settings(): array {
		return array();
	}

	public function sanitize( array $data ): array {
		unset( $data );
		return array();
	}

	public function register(): void {
		add_action( 'init', array( $this, 'register_block' ) );
	}

	public function register_block(): void {
		register_block_type( BW_DEV_DIR . 'blocks/subtitle' );
	}

	public function render_tab(): void {
		?>
		<p class="description">
			<?php esc_html_e( 'Adds the "BW Subtitle" Gutenberg block — an eyebrow / kicker text with uppercase letter-spaced styling. Useful above headings as a section label.', 'bw-dev' ); ?>
		</p>

		<h3><?php esc_html_e( 'Block options', 'bw-dev' ); ?></h3>
		<ul style="list-style:disc;margin-left:20px;">
			<li><strong><?php esc_html_e( 'Text:', 'bw-dev' ); ?></strong> <?php esc_html_e( 'The subtitle copy.', 'bw-dev' ); ?></li>
			<li><strong><?php esc_html_e( 'Alignment:', 'bw-dev' ); ?></strong> <?php esc_html_e( 'Left, center, or right.', 'bw-dev' ); ?></li>
			<li><strong><?php esc_html_e( 'Color:', 'bw-dev' ); ?></strong> <?php esc_html_e( 'Free custom color picker. Leave blank to inherit the theme text color.', 'bw-dev' ); ?></li>
			<li><strong><?php esc_html_e( 'Link:', 'bw-dev' ); ?></strong> <?php esc_html_e( 'Optional URL with same-tab / new-tab toggle.', 'bw-dev' ); ?></li>
		</ul>

		<p class="description">
			<?php esc_html_e( 'Find it in the block inserter under the BW Blocks category.', 'bw-dev' ); ?>
		</p>
		<?php
	}

	public function uninstall(): void {
		// No persisted state.
	}
}
