Files
2024-11-04 20:48:19 +01:00

214 lines
7.1 KiB
PHP

<?php namespace Elementor;
class restly_line_Widget extends Widget_Base {
public function get_name() {
return 'restly_line';
}
public function get_title() {
return esc_html__( 'Restly Line', 'restlycore' );
}
public function get_icon() {
return 'eicon-section';
}
public function get_categories() {
return ['restly'];
}
protected function register_controls() {
//Content tab start
$this->start_controls_section(
'restly_line_options',
[
'label' => esc_html__( 'restly line', 'restlycore' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'restly_line_width',
[
'label' => esc_html__( 'Width', 'restlycore' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%' ],
'range' => [
'px' => [
'min' => 0,
'max' => 5000,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .restly-line-bg' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_line_height',
[
'label' => esc_html__( 'Height', 'restlycore' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%' ],
'range' => [
'px' => [
'min' => 0,
'max' => 5000,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .restly-line-bg' => 'height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Background::get_type(),
[
'name' => 'restly_line_bg',
'label' => esc_html__( 'Background', 'restlycore' ),
'types' => [ 'classic', 'gradient', 'video' ],
'selector' => '{{WRAPPER}} .restly-line-bg',
]
);
$this->add_group_control(
\Elementor\Group_Control_Border::get_type(),
[
'name' => 'restly_line_border',
'label' => esc_html__( 'Border', 'restlycore' ),
'selector' => '{{WRAPPER}} .restly-line-bg',
]
);
$this->add_group_control(
\Elementor\Group_Control_Box_Shadow::get_type(),
[
'name' => 'restly_line_shadow',
'label' => esc_html__( 'Box Shadow', 'restlycore' ),
'selector' => '{{WRAPPER}} .restly-line-bg',
]
);
$this->add_responsive_control(
'restly_line_radius',
[
'label' => esc_html__( 'Border Radius', 'restlycore' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%' ],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .restly-line-bg' => 'border-radius: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_line_margin',
[
'label' => esc_html__( 'Margin', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .restly-line-bg' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_line_pading',
[
'label' => esc_html__( 'Padding', 'restlycore' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .restly-line-bg' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_line_position',
[
'label' => esc_html__( 'Select Position', 'restlycore' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'absolute',
'options' => [
'absolute' => esc_html__( 'Absolute', 'restlycore' ),
'relative' => esc_html__( 'Relative', 'restlycore' ),
'unset' => esc_html__( 'unset', 'restlycore' ),
],
'selectors' => [
'{{WRAPPER}} .restly-line-bg' => 'position: {{VALUE}};',
],
]
);
$this->add_responsive_control(
'restly_line_top',
[
'label' => esc_html__( 'Top To Bottom', 'restlycore' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%' ],
'range' => [
'px' => [
'min' => -800,
'max' => 500,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .restly-line-bg' => 'top: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'restly_line_left',
[
'label' => esc_html__( 'Left To Right', 'restlycore' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%' ],
'range' => [
'px' => [
'min' => -800,
'max' => 500,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .restly-line-bg' => 'left: {{SIZE}}{{UNIT}};',
],
]
);
$this->end_controls_section();
}
//Render
protected function render() {
$settings = $this->get_settings_for_display();
ob_start();
?>
<div class="restly-line-bg-wrapper">
<div class="restly-line-bg"></div>
</div>
<?php
echo ob_get_clean();
}
}
Plugin::instance()->widgets_manager->register( new restly_line_Widget );