| 1 |
<?php |
| 2 |
|
| 3 |
namespace Borderless\Widgets; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 6 |
|
| 7 |
use Elementor\Widget_Base; |
| 8 |
use Elementor\Controls_Manager; |
| 9 |
use Elementor\Group_Control_Image_Size; |
| 10 |
use Elementor\Utils; |
| 11 |
|
| 12 |
class Marquee_Text extends Widget_Base { |
| 13 |
|
| 14 |
public function get_name() { |
| 15 |
return 'marquee-text'; |
| 16 |
} |
| 17 |
|
| 18 |
public function get_title() { |
| 19 |
return 'Marquee Text'; |
| 20 |
} |
| 21 |
|
| 22 |
public function get_icon() { |
| 23 |
return 'fa fa-envelope-o'; |
| 24 |
} |
| 25 |
|
| 26 |
public function get_categories() { |
| 27 |
return [ 'borderless' ]; |
| 28 |
} |
| 29 |
|
| 30 |
protected function _register_controls() { |
| 31 |
|
| 32 |
$this->start_controls_section( |
| 33 |
'section_content', |
| 34 |
[ |
| 35 |
'label' => esc_html__( 'Content', 'borderless' ), |
| 36 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 37 |
] |
| 38 |
); |
| 39 |
|
| 40 |
$this->add_control( |
| 41 |
'borderless_elementor_marquee_text_content', |
| 42 |
[ |
| 43 |
'label' => __( 'Text', 'borderless' ), |
| 44 |
'type' => \Elementor\Controls_Manager::WYSIWYG, |
| 45 |
'default' => __( 'Default description', 'borderless' ), |
| 46 |
'placeholder' => __( 'Type your description here', 'borderless' ), |
| 47 |
] |
| 48 |
); |
| 49 |
|
| 50 |
$this->end_controls_section(); |
| 51 |
|
| 52 |
$this->start_controls_section( |
| 53 |
'borderless_section_marquee_text_settings', |
| 54 |
[ |
| 55 |
'label' => esc_html__( 'Settings', 'borderless' ), |
| 56 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 57 |
] |
| 58 |
); |
| 59 |
|
| 60 |
$this->add_control( |
| 61 |
'borderless_marquee_text_start_visible', |
| 62 |
[ |
| 63 |
'label' => __( 'Start Visible', 'borderless' ), |
| 64 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 65 |
'return_value' => 'true', |
| 66 |
'default' => 'true', |
| 67 |
] |
| 68 |
); |
| 69 |
|
| 70 |
$this->add_control( |
| 71 |
'borderless_marquee_text_duplicated', |
| 72 |
[ |
| 73 |
'label' => __( 'Duplicated', 'borderless' ), |
| 74 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 75 |
'return_value' => 'true', |
| 76 |
'default' => 'true', |
| 77 |
] |
| 78 |
); |
| 79 |
|
| 80 |
$this->add_control( |
| 81 |
'borderless_marquee_text_pause_on_hover', |
| 82 |
[ |
| 83 |
'label' => __( 'Pause On Hover', 'borderless' ), |
| 84 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 85 |
'return_value' => 'true', |
| 86 |
'default' => 'false', |
| 87 |
] |
| 88 |
); |
| 89 |
|
| 90 |
$this->add_control( |
| 91 |
'borderless_marquee_text_direction', |
| 92 |
[ |
| 93 |
'label' => __( 'Direction', 'borderless' ), |
| 94 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 95 |
'default' => 'left', |
| 96 |
'options' => [ |
| 97 |
'left' => __( 'Left', 'borderless' ), |
| 98 |
'right' => __( 'Right', 'borderless' ), |
| 99 |
], |
| 100 |
] |
| 101 |
); |
| 102 |
|
| 103 |
$this->add_control( |
| 104 |
'borderless_marquee_text_duration', |
| 105 |
[ |
| 106 |
'label' => __( 'Duration', 'borderless' ), |
| 107 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 108 |
'min' => 1000, |
| 109 |
'max' => 100000, |
| 110 |
'step' => 100, |
| 111 |
'default' => 5000, |
| 112 |
] |
| 113 |
); |
| 114 |
|
| 115 |
$this->add_control( |
| 116 |
'borderless_marquee_text_gap', |
| 117 |
[ |
| 118 |
'label' => __( 'Gap', 'borderless' ), |
| 119 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 120 |
'min' => 0, |
| 121 |
'max' => 99999, |
| 122 |
'step' => 1, |
| 123 |
'default' => 50, |
| 124 |
] |
| 125 |
); |
| 126 |
|
| 127 |
$this->add_control( |
| 128 |
'borderless_marquee_text_delay_before_start', |
| 129 |
[ |
| 130 |
'label' => __( 'Delay Before Start', 'borderless' ), |
| 131 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 132 |
'min' => 0, |
| 133 |
'max' => 99999, |
| 134 |
'step' => 1, |
| 135 |
'default' => 0, |
| 136 |
] |
| 137 |
); |
| 138 |
|
| 139 |
|
| 140 |
$this->end_controls_section(); |
| 141 |
} |
| 142 |
|
| 143 |
protected function render() { |
| 144 |
|
| 145 |
$settings = $this->get_settings(); |
| 146 |
|
| 147 |
echo'<div class="borderless-elementor-marquee-text-widget"><div class="borderless-elementor-marquee-text" direction="'.$settings['borderless_marquee_text_direction'].'" duration="'.$settings['borderless_marquee_text_duration'].'" delay-before-start="'.$settings['borderless_marquee_text_delay_before_start'].'" gap="'.$settings['borderless_marquee_text_gap'].'" start-visible="'.$settings['borderless_marquee_text_start_visible'].'" duplicated="'.$settings['borderless_marquee_text_duplicated'].'" pause-on-hover="'.$settings['borderless_marquee_text_pause_on_hover'].'"> |
| 148 |
'.$settings['borderless_elementor_marquee_text_content'].' |
| 149 |
</div></div>'; |
| 150 |
|
| 151 |
} |
| 152 |
|
| 153 |
protected function _content_template() { |
| 154 |
|
| 155 |
} |
| 156 |
|
| 157 |
|
| 158 |
} |