<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
/**
* About Us Widget.
*
* @version 1.0
* @author themebubble
* @category Classes
* @author themebubble
*/
class RS_Video_Block_Widget extends Widget_Base {
public function get_name() {
return 'rs-video-block-widget';
}
public function get_title() {
return 'Video Block';
}
public function get_icon() {
return 'elem_icon vc_image_video_icon';
}
public function get_categories() {
return array('magplus-elementor');
}
protected function _register_controls() {
$this->start_controls_section(
'video_block_general_settings',
array(
'label' => esc_html__( 'General' , 'magplus-addons' )
)
);
$this->add_control(
'video_url',
array(
'label' => esc_html__( 'Video URL', 'magplus-addons' ),
'type' => Controls_Manager::TEXT,
'default' => 'https://player.vimeo.com/video/171807697?color=f561af&badge=0',
'label_block' => true,
)
);
$this->end_controls_section();
$this->start_controls_section('section_general_style',
array(
'label' => esc_html__('General Style', 'magplus-addons'),
'tab' => Controls_Manager::TAB_STYLE,
)
);
$this->add_group_control(
Group_Control_Background::get_type(),
array(
'name' => 'background',
'label' => esc_html__('Background', 'magplus-addons'),
'types' => array('classic', 'gradient'),
'selector' => '{{WRAPPER}} .video-block-wrapper',
)
);
$this->add_responsive_control(
'margin',
array(
'label' => esc_html__('Margin', 'magplus-addons'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array('px', 'em', '%'),
'selectors' => array(
'{{WRAPPER}} .video-block-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
)
);
$this->add_responsive_control(
'padding',
array(
'label' => esc_html__('Padding', 'magplus-addons'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array('px', 'em', '%'),
'selectors' => array(
'{{WRAPPER}} .video-block-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
)
);
$this->add_group_control(
Group_Control_Border::get_type(),
array(
'name' => 'border',
'selector' => '{{WRAPPER}} .video-block-wrapper'
)
);
$this->add_responsive_control(
'border_radius',
array(
'label' => esc_html__('Border Raidus', 'magplus-addons'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array('px', 'em', '%'),
'selectors' => array(
'{{WRAPPER}} .video-block-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
)
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
array(
'name' => 'box_shadow',
'label' => esc_html__('Box Shadow', 'magplus-addons'),
'selector' => '{{WRAPPER}} .video-block-wrapper',
)
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings();
$atts = array(
'video_url' => $settings['video_url'],
);
echo rs_video_block($atts);
}
}
Plugin::instance()->widgets_manager->register_widget_type( new RS_Video_Block_Widget() ); |