<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; }
use Elementor\Widget_Base;
use Sifency\Classes\Sifency_Addons_Widget_Base;
use Sifency\Classes\Sifency_Themebuilder_Widget_Base;
use Elementor\Controls_Manager;
use Sifency\Traits\Sifency_Addons_Animation_Controls;
use Sifency\Traits\Sifency_Addons_Animation_Manager;
use Sifency\Traits\Sifency_Addons_Label_Content_Controls;
use Sifency\Traits\Sifency_Addons_TB_Separator_Content_Controls;
use Sifency\Traits\Sifency_Addons_Trio_Text_Style_Controls;
use Sifency\Traits\Render_Sifency_Addons_TB_Meta;
use Sifency\Traits\Sifency_Addons_Themebuilder_Controls;
class Sifency_Widget_Doc_Copyright extends Sifency_Themebuilder_Widget_Base {
	use Sifency_Addons_Animation_Controls;
	use Sifency_Addons_Label_Content_Controls;
	use Sifency_Addons_TB_Separator_Content_Controls;
	use Sifency_Addons_Trio_Text_Style_Controls;
	use Render_Sifency_Addons_TB_Meta;
	use Sifency_Addons_Themebuilder_Controls;

	protected function get_allowed_template_types() {
		return 'documentation';
	}
	public function __construct( $data = array(), $args = null ) {
		parent::__construct( $data, $args );
		$this->wg_config = array(
			'name'          => 'sifency-doc-copyright',
			'title'         => 'Doc Copyright',
			'icon'          => 'eicon-speakerphone',
			'category'      => array( 'sifency-doc-components' ),
			'keywords'      => array( 'doc', 'copyright', 'meta', 'dynamic', 'sifency' ),
			'style_depends' => array( 'sifency-typo-style' ),
		);}

	protected function register_controls() {
		$this->add_sifency_addons_themebuilder_controls( array( 'placeholder_text' => 'ALL RIGHT RESERVED' ) );
	}
	protected function render_dom( array $context ) {
		$wrapper_id = esc_attr( $context['dom_id'] );
		$settings   = $this->get_settings_for_display();

		$dynamic_data = sifency_get_field( 'doc_copyeight_text' );
		$display_text = '';

		if ( ! empty( $dynamic_data ) ) {
			$display_text = $dynamic_data;
		} elseif ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
			$display_text = $settings['placeholder_text'];
		}

		if ( empty( $display_text ) ) {
			return;
		}
		$animation_manager = new Sifency_Addons_Animation_Manager( $settings );
		$animation_attrs   = $animation_manager->get_wrapper_attributes( array() ); ?>
		<?php $this->render_sifency_addons_tb_meta( $display_text, $animation_attrs ); ?>
		<?php
	}
}
