<?php
/**
 * Inline Theme 4 — Quote.
 *
 * @package     Relatedly\Theming\Inline
 * @since       2.0.0
 * @fs_premium_only
 */

namespace Relatedly\Theming\Inline;

use Relatedly\Theming\AbstractTheme;

defined( 'ABSPATH' ) || exit;

/**
 * Inline Theme 4 — Quote renderer.
 *
 * @since 2.0.0
 */
class Theme4Quote extends AbstractTheme {
	/**
	 * Template file name.
	 *
	 * @var string
	 */
	protected string $template_file = 'inline/quote.php';

	/**
	 * Get the display type.
	 *
	 * @since 2.0.0
	 * @return string
	 */
	protected function display_type(): string {
		return 'inline';
	}

	/**
	 * Build template variables.
	 *
	 * @since 2.0.0
	 * @param \WP_Post $post      Post object.
	 * @param int|null $source_id Source post ID.
	 * @return array
	 */
	protected function template_vars( \WP_Post $post, ?int $source_id ): array {
		$vars                 = parent::template_vars( $post, $source_id );
		$vars['css_vars']     = $this->css_vars(
			array(
				'--relatedly-bg'            => 'inline_theme4_bg',
				'--relatedly-accent'        => 'inline_theme4_accent_color',
				'--relatedly-title-color'   => 'inline_theme4_title_color',
				'--relatedly-title-size'    => 'inline_theme4_title_size',
				'--relatedly-title-style'   => 'inline_theme4_title_style',
				'--relatedly-excerpt-color' => 'inline_theme4_excerpt_color',
				'--relatedly-excerpt-size'  => 'inline_theme4_excerpt_size',
				'--relatedly-padding'       => 'inline_theme4_padding',
			)
		);
		$vars['show_excerpt'] = (bool) $this->options->get( 'inline_theme4_show_excerpt', true );
		return $vars;
	}
}
