<?php
if ( ! defined( 'ABSPATH' ) ) exit;
;
/**
 * Sifency Documentation Archive Render
 * Uses a dedicated Elementor template for the Documentation archive.
 */
if ( Sifency_Addons_Theme_Builder_Master::sifency_addons_is_legal() ) {
final class Sifency_Digital_Archive_Render {

    public function __construct() {
        if ( is_admin() ) return;
        add_filter( 'template_include', [ $this, 'override_digital_archive_template' ], 999 );
    }

    public function override_digital_archive_template( $template ) {

        
        if ( ! is_post_type_archive( 'digital' ) ) {
            return $template;
        }

        $canvas_path = SIFENCY_TB_PATH . 'post-type/digital/templates/sifency-digital-archive-canvas.php';

        if ( ! file_exists( $canvas_path ) ) {
            return $template;
        }

        $sifency_addons_template_id = Sifency_Frontend_Helper::find_matching_template( 'digital-archive' );
        set_query_var( 'sifency_digital_archive_template_id', $sifency_addons_template_id );

        return $canvas_path;
    }
}}
