start_controls_section( 'video_banner', [ 'label' => esc_html__( 'Thinkai Video Banner', 'thinkai' ), ] ); $this->add_control( 'layout_control', [ 'label' => esc_html__( 'Layout Style', 'thinkai' ), 'label_block' => true, 'type' => Controls_Manager::SELECT, 'default' => '1', 'options' => array( '1' => esc_html__( 'Style One ', 'thinkai'), '2' => esc_html__( 'Style Two ', 'thinkai'), ), ] ); $this->add_control( 'video_img', [ 'label' => __( 'Video Image', 'thinkai' ), 'type' => Controls_Manager::MEDIA, 'default' => ['url' => Utils::get_placeholder_image_src(),], 'condition' => [ 'layout_control' => '2', ], ] ); //Video Link Option $this->add_control( 'video_option', [ 'label' => __( 'Select Video Type', 'thinkai' ), 'label_block' => true, 'type' => Controls_Manager::SELECT, 'default' => 'src_url', 'options' => array( 'src_url' => esc_html__( 'Source URL', 'thinkai' ), 'src_media' => esc_html__( 'Source Media', 'thinkai' ), ), ] ); $this->add_control( 'video_link', [ 'label' => __( 'Video Source Url', 'thinkai' ), 'type' => Controls_Manager::URL, 'label_block' => true, 'placeholder' => __( 'https://your-link.com', 'thinkai' ), 'show_external' => true, 'default' => [ 'url' => '', ], 'condition' => [ 'video_option' => 'src_url' ], ] ); $this->add_control( 'video_source_image', [ 'label' => __( 'Video Source Media', 'thinkai' ), 'type' => Controls_Manager::MEDIA, 'media_types' => ['video'], 'condition' => [ 'video_option' => 'src_media' ], ] ); //Title $this->add_control( 'title', [ 'label' => __( 'Title', 'thinkai' ), 'type' => Controls_Manager::TEXTAREA, 'label_block' => true, 'dynamic' => [ 'active' => true, ], 'default' => esc_html__( 'Image Generator', 'thinkai' ), ] ); //Text $this->add_control( 'text', [ 'label' => __( 'Description', 'thinkai' ), 'type' => Controls_Manager::TEXTAREA, 'label_block' => true, 'dynamic' => [ 'active' => true, ], 'default' => esc_html__( 'Convert text to image.', 'thinkai' ), 'condition' => [ 'layout_control' => '1', ], ] ); //Button Title $this->add_control( 'btn_title', [ 'label' => __( 'Button Title', 'thinkai' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'dynamic' => [ 'active' => true, ], 'default' => esc_html__( 'Try a Template', 'thinkai' ), 'condition' => [ 'layout_control' => '1', ], ] ); $this->add_control( 'link_option', [ 'label' => esc_html__( 'Select link Option', 'thinkai' ), 'label_block' => true, 'type' => Controls_Manager::SELECT, 'default' => 'extranal', 'options' => array( 'extranal' => esc_html__( 'Extranal ', 'thinkai'), 'page' => esc_html__( 'Page ', 'thinkai'), ), 'condition' => [ 'layout_control' => '1', ], ] ); $this->add_control( 'link', [ 'label' => __( 'External Link', 'thinkai' ), 'type' => Controls_Manager::URL, 'label_block' => true, 'placeholder' => __( 'https://your-link.com', 'thinkai' ), 'show_external' => true, 'default' => [ 'url' => '', 'is_external' => true, 'nofollow' => true, ], 'condition' => [ 'layout_control' => '1', 'link_option' => 'extranal' ] ] ); $this->add_control( 'page_select', [ 'label' => esc_html__( 'Select Page', 'thinkai' ), 'label_block' => true, 'type' => Controls_Manager::SELECT2, 'default' => 'extranal', 'options' => thinkai_page_list(), 'condition' => [ 'layout_control' => '1', 'link_option' => 'page' ] ] ); //Switcher $this->add_control( 'show_email_info', [ 'label' => esc_html__( 'Enable Email Info', 'thinkai' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'On', 'thinkai' ), 'label_off' => esc_html__( 'Off', 'thinkai' ), 'return_value' => 'yes', 'default' => 'no', 'condition' => [ 'layout_control' => '1', ], ] ); $this->add_control( 'email_title', [ 'label' => esc_html__( 'Email Title', 'thinkai' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'default' => esc_html__( 'Have Question?', 'thinkai' ), 'condition' => [ 'layout_control' => '1', 'show_email_info' => 'yes' ] ] ); $this->add_control( 'email_address', [ 'label' => esc_html__( 'Email Address', 'thinkai' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'default' => esc_html__( 'info@example.com', 'thinkai' ), 'condition' => [ 'layout_control' => '1', 'show_email_info' => 'yes' ] ] ); $this->end_controls_section(); } /** * Render button widget output on the frontend. * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); $allowed_tags = wp_kses_allowed_html('post'); $layout = $settings[ 'layout_control' ]; $video_option = $settings[ 'video_option' ]; if( $video_option == 'src_url' ){ $video = $settings[ 'video_link' ][ 'url' ]; }elseif( $video_option == 'src_media' ){ $video = $settings[ 'video_source_image' ]['url']; }else{ $video = esc_html__( 'There is no Video', 'thinkai' ); } ?>