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

namespace Relatedly\Theming\Inline;

use Relatedly\Theming\AbstractTheme;

defined( 'ABSPATH' ) || exit;

/**
 * Renders the premium gradient inline theme.
 *
 * @since 2.0.0
 */
class Theme7Gradient extends AbstractTheme {
	/**
	 * Template file name.
	 *
	 * @var string
	 */
	protected string $template_file = 'inline/gradient.php';

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

	/**
	 * Build template variables.
	 *
	 * @param \WP_Post $post      Post object.
	 * @param int|null $source_id Source post ID.
	 * @return array<string,mixed>
	 */
	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-gradient-start' => 'inline_theme7_gradient_start',
				'--relatedly-gradient-end'   => 'inline_theme7_gradient_end',
				'--relatedly-title-color'    => 'inline_theme7_title_color',
				'--relatedly-title-size'     => 'inline_theme7_title_size',
				'--relatedly-excerpt-color'  => 'inline_theme7_excerpt_color',
				'--relatedly-excerpt-size'   => 'inline_theme7_excerpt_size',
				'--relatedly-padding'        => 'inline_theme7_padding',
			)
		);
		$vars['show_excerpt'] = (bool) $this->options->get( 'inline_theme7_show_excerpt', true );
		return $vars;
	}
}
