<?php
/**
 * Front-end markup for RSM Headline widget.
 *
 * @package Rsmspark_Content_Widgets
 */

defined( 'ABSPATH' ) || exit;

$wrapper_classes = array(
	'rsmspark-cw',
	'rsmspark-cw-headline',
);
if ( ! empty( $border_enabled ) ) {
	$wrapper_classes[] = 'rsmspark-cw-headline--has-border';
}
?>
<section
	class="<?php echo esc_attr( implode( ' ', $wrapper_classes ) ); ?>"
	style="<?php echo esc_attr( $inline_style ); ?>"
>
	<div class="rsmspark-cw-headline__inner">
		<?php if ( ! empty( $has_content ) ) : ?>
			<?php if ( ! empty( $has_overline ) ) : ?>
				<p class="rsmspark-cw-headline__overline rsmspark-rt-root"><?php echo wp_kses( $overline, Rsmspark_Content_Widgets_Headline_Styles::allowed_line_html() ); ?>
			<?php endif; ?>
			<?php if ( ! empty( $has_headline ) ) : ?>
				<?php
				printf(
					'<%1$s class="rsmspark-cw-headline__title rsmspark-rt-root">%2$s</%1$s>',
					tag_escape( $headline_tag ),
					wp_kses( $headline, Rsmspark_Content_Widgets_Headline_Styles::allowed_line_html() )
				);
				?>
			<?php endif; ?>
			<?php if ( ! empty( $has_subheadline ) ) : ?>
				<p class="rsmspark-cw-headline__subheadline rsmspark-rt-root"><?php echo wp_kses( $subheadline, Rsmspark_Content_Widgets_Headline_Styles::allowed_line_html() ); ?>
			<?php endif; ?>
		<?php else : ?>
			<p class="rsmspark-cw-headline__placeholder"><?php esc_html_e( 'Add overline, headline, or subheadline text in the widget settings.', 'rsm-content-widgets' ); ?></p>
		<?php endif; ?>
	</div>
</section>
