<?php
namespace ThimPress\ThimBlocks\Gutenberg\Blocks\Tabs;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

use ThimPress\ThimBlocks\Gutenberg\Blocks\AbstractBlockType;
use Throwable;

class TabsBlockType extends AbstractBlockType {
	public $block_name = 'tabs';

	public function get_supports(): array {
		return array(
			'align'   => true,
			'anchor'  => false,
			'spacing' => array(
				'margin'  => true,
				'padding' => true,
			),
		);
	}

	public function render_content_block_template( array $attributes, $content, $block ): string {
		$html = '';

		try {
			$handle = 'thim-blocks-view-' . $this->block_name;
			wp_enqueue_script( $handle );
			ob_start();
			echo wp_kses_post( $content );
			$html = ob_get_clean();
		} catch ( Throwable $e ) {
			return $html;
		}
		return $html;
	}

}
