start_controls_section( 'video_section', array( 'label' => esc_html__( 'Hero Video', 'addonnest' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ) ); $this->add_control( 'hero_video', array( 'label' => esc_html__( 'Video File', 'addonnest' ), 'type' => \Elementor\Controls_Manager::MEDIA, 'media_type' => 'video', ) ); $this->add_control( 'video_screenshot', array( 'label' => esc_html__( 'Video Screenshot (Poster)', 'addonnest' ), 'type' => \Elementor\Controls_Manager::MEDIA, 'media_type' => 'image', ) ); $this->end_controls_section(); // Content Section. $this->start_controls_section( 'content_section', array( 'label' => esc_html__( 'Content', 'addonnest' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ) ); $this->add_control( 'title', array( 'label' => esc_html__( 'Title', 'addonnest' ), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => esc_html__( 'Your Title Here', 'addonnest' ), ) ); $this->add_control( 'description', array( 'label' => esc_html__( 'Description', 'addonnest' ), 'type' => \Elementor\Controls_Manager::TEXTAREA, 'default' => esc_html__( 'Your description goes here.', 'addonnest' ), ) ); $this->add_control( 'button_text', array( 'label' => esc_html__( 'Button Text', 'addonnest' ), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => esc_html__( 'Learn More', 'addonnest' ), ) ); $this->add_control( 'button', array( 'label' => esc_html__( 'Button Link', 'addonnest' ), 'type' => \Elementor\Controls_Manager::URL, 'placeholder' => esc_url( 'https://your-link.com' ), 'show_external' => true, ) ); $this->end_controls_section(); // Style Tab. $this->start_controls_section( 'style_section', array( 'label' => esc_html__( 'Style', 'addonnest' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ) ); // Video Style. $this->add_control( 'video_style', array( 'label' => esc_html__( 'Video Style', 'addonnest' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ) ); $this->add_responsive_control( 'video_height', array( 'label' => esc_html__( 'Video Height', 'addonnest' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => array( 'px', 'em', 'vh' ), 'range' => array( 'px' => array( 'min' => 0, 'max' => 1000, ), 'vh' => array( 'min' => 0, 'max' => 100, ), ), 'selectors' => array( '{{WRAPPER}} .villa-hero-video' => 'height: {{SIZE}}{{UNIT}};', ), ) ); $this->add_responsive_control( 'video_filter', array( 'label' => esc_html__( 'Video Brightness', 'addonnest' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 0.1, 'max' => 1, 'step' => 0.1, ), ), 'default' => array( 'size' => 1, ), 'selectors' => array( '{{WRAPPER}} .villa-hero-video .hero-video video.video-bg' => 'filter: brightness({{SIZE}});', ), ) ); $this->add_responsive_control( 'content_align', [ 'label' => esc_html__( 'Alignment', 'addonnest' ), 'type' => \Elementor\Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__( 'Left', 'addonnest' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => esc_html__( 'Center', 'addonnest' ), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => esc_html__( 'Right', 'addonnest' ), 'icon' => 'eicon-text-align-right', ] ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .villa-hero-video .content-info' => 'text-align: {{VALUE}};', ], ] ); // Title Style. $this->add_control( 'title_style_heading', array( 'label' => esc_html__( 'Title', 'addonnest' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ) ); $this->add_control( 'title_color', array( 'label' => esc_html__( 'Text Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .villa-hero-video .content-info h2' => 'color: {{VALUE}};', ), ) ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), array( 'name' => 'title_typography', 'label' => esc_html__( 'Typography', 'addonnest' ), 'selector' => '{{WRAPPER}} .villa-hero-video .content-info h2', ) ); $this->add_responsive_control( 'title_margin', array( 'label' => esc_html__( 'Margin', 'addonnest' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', 'em', '%' ), 'selectors' => array( '{{WRAPPER}} .villa-hero-video .content-info h2' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ) ); // Description Style. $this->add_control( 'descriptions_style', array( 'label' => esc_html__( 'Description', 'addonnest' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ) ); $this->add_control( 'descriptions_color', array( 'label' => esc_html__( 'Text Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .villa-hero-video .content-info p' => 'color: {{VALUE}};', ), ) ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), array( 'name' => 'descriptions_typography', 'label' => esc_html__( 'Typography', 'addonnest' ), 'selector' => '{{WRAPPER}} .villa-hero-video .content-info p', ) ); $this->add_responsive_control( 'descriptions_space', array( 'label' => esc_html__( 'Spacing', 'addonnest' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => array( 'px', 'em' ), 'range' => array( 'px' => array( 'min' => 0, 'max' => 100, ), ), 'selectors' => array( '{{WRAPPER}} .villa-hero-video .content-info p' => 'margin-bottom: {{SIZE}}{{UNIT}};', ), ) ); // Button Style. $this->add_control( 'button_style_heading', array( 'label' => esc_html__( 'Button', 'addonnest' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ) ); $this->add_control( 'button_text_color', array( 'label' => esc_html__( 'Text Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .villa-hero-video .content-info a' => 'color: {{VALUE}};', ), ) ); $this->add_control( 'button_bg_color', array( 'label' => esc_html__( 'Background Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .villa-hero-video .content-info a' => 'background-color: {{VALUE}};', ), ) ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), array( 'name' => 'button_typography', 'label' => esc_html__( 'Typography', 'addonnest' ), 'selector' => '{{WRAPPER}} .villa-hero-video .content-info a', ) ); $this->add_responsive_control( 'button_padding', array( 'label' => esc_html__( 'Padding', 'addonnest' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', 'em', '%' ), 'selectors' => array( '{{WRAPPER}} .villa-hero-video .content-info a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ) ); $this->add_responsive_control( 'button_border_radius', array( 'label' => esc_html__( 'Border Radius', 'addonnest' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%' ), 'selectors' => array( '{{WRAPPER}} .villa-hero-video .content-info a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ) ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), array( 'name' => 'button_border', 'label' => esc_html__( 'Border', 'addonnest' ), 'selector' => '{{WRAPPER}} .villa-hero-video .content-info a', ) ); $this->add_control( 'button_hover_heading', array( 'label' => esc_html__( 'Hover State', 'addonnest' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ) ); $this->add_control( 'button_hover_text_color', array( 'label' => esc_html__( 'Text Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .villa-hero-video .content-info a:hover' => 'color: {{VALUE}};', ), ) ); $this->add_control( 'button_hover_bg_color', array( 'label' => esc_html__( 'Background Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .villa-hero-video .content-info a:hover' => 'background-color: {{VALUE}};', ), ) ); $this->add_control( 'button_hover_border_color', array( 'label' => esc_html__( 'Border Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .villa-hero-video .content-info a:hover' => 'border-color: {{VALUE}};', ), ) ); $this->end_controls_section(); } /** * Render widget output. */ protected function render() { $settings = $this->get_settings_for_display(); $video_url = ! empty( $settings['hero_video']['url'] ) ? $settings['hero_video']['url'] : ''; $poster = ! empty( $settings['video_screenshot']['url'] ) ? $settings['video_screenshot']['url'] : ''; $title = ! empty( $settings['title'] ) ? $settings['title'] : ''; $description = ! empty( $settings['description'] ) ? $settings['description'] : ''; $button_text = ! empty( $settings['button_text'] ) ? $settings['button_text'] : esc_html__( 'Learn More', 'addonnest' ); $button = $settings['button']; $target = $button['is_external'] ? ' target="_blank"' : ''; $nofollow = $button['nofollow'] ? ' rel="nofollow"' : ''; ?>
widgets_manager->register( new AddonNest_Widget_Hero_Video() );