templates
1 year ago
Accordion.php
1 year ago
Alerts_Box.php
1 year ago
Animated_Heading.php
1 year ago
Before_after.php
1 year ago
Blog_Grid.php
1 year ago
Buttons.php
1 year ago
Cheat_sheet.php
1 year ago
Counter.php
1 year ago
Fullscreen_Slider.php
1 year ago
Icon_box.php
1 year ago
Instagram.php
1 year ago
Integrations.php
1 year ago
List_Item.php
1 year ago
Pricing_Table_Switcher.php
1 year ago
Pricing_Table_Tabs.php
1 year ago
Tabs.php
1 year ago
Team_Carousel.php
1 year ago
Testimonial.php
1 year ago
Timeline.php
1 year ago
Video_Playlist.php
1 year ago
Video_Popup.php
1 year ago
Animated_Heading.php
306 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Use namespace to avoid conflict |
| 5 | */ |
| 6 | |
| 7 | namespace SPEL\Widgets; |
| 8 | |
| 9 | use Elementor\Widget_Base; |
| 10 | use Elementor\Repeater; |
| 11 | use Elementor\Controls_Manager; |
| 12 | use Elementor\Group_Control_Typography; |
| 13 | |
| 14 | // Exit if accessed directly |
| 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | exit; |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Class Alerts_box |
| 21 | * @package spider\Widgets |
| 22 | * @since 1.0.0 |
| 23 | */ |
| 24 | class Animated_Heading extends Widget_Base { |
| 25 | |
| 26 | public function get_name() { |
| 27 | return 'spe_animated_heading'; // ID of the widget (Don't change this name) |
| 28 | } |
| 29 | |
| 30 | public function get_title() { |
| 31 | return esc_html__( 'Animated Heading', 'spider-elements' ); |
| 32 | } |
| 33 | |
| 34 | public function get_icon() { |
| 35 | return 'eicon-heading spel-icon'; |
| 36 | } |
| 37 | |
| 38 | public function get_keywords() { |
| 39 | return [ 'Heading', 'Animated', 'Animated Heading' ]; |
| 40 | } |
| 41 | |
| 42 | public function get_categories() { |
| 43 | return [ 'spider-elements' ]; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Name: get_script_depends() |
| 48 | * Desc: Register the required JS dependencies for the frontend. |
| 49 | */ |
| 50 | public function get_script_depends() { |
| 51 | return [ 'text-type' ]; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Name: register_controls() |
| 56 | * Desc: Register controls for these widgets |
| 57 | * Params: no params |
| 58 | * Return: @void |
| 59 | * Since: @1.0.0 |
| 60 | * Package: @spider-elements |
| 61 | * Author: spider-themes |
| 62 | */ |
| 63 | protected function register_controls() { |
| 64 | $this->elementor_content_control(); |
| 65 | $this->elementor_style_control(); |
| 66 | } |
| 67 | |
| 68 | |
| 69 | /** |
| 70 | * Name: elementor_content_control() |
| 71 | * Desc: Register the Content Tab output on the Elementor editor. |
| 72 | * Params: no params |
| 73 | * Return: @void |
| 74 | * Since: @1.0.0 |
| 75 | * Package: @spider-elements |
| 76 | * Author: spider-themes |
| 77 | */ |
| 78 | public function elementor_content_control() { |
| 79 | //============================= Filter Options =================================== // |
| 80 | $this->start_controls_section( |
| 81 | 'se_animated_headline_sec', |
| 82 | [ |
| 83 | 'label' => esc_html__( 'Title', 'spider-elements' ), |
| 84 | ] |
| 85 | ); |
| 86 | |
| 87 | $this->add_control( |
| 88 | 'headline_before_text', [ |
| 89 | 'label' => esc_html__( 'Before Title', 'spider-elements' ), |
| 90 | 'type' => Controls_Manager::TEXT, |
| 91 | 'default' => esc_html__( "I’m a", 'spider-elements' ), |
| 92 | 'placeholder' => esc_html__( 'Type your section ID here', 'spider-elements' ), |
| 93 | ] |
| 94 | ); |
| 95 | |
| 96 | $this->end_controls_section(); //End Filter |
| 97 | |
| 98 | $this->start_controls_section( |
| 99 | 'se_clip_list', [ |
| 100 | 'label' => esc_html__( 'Clip List', 'spider-elements' ) |
| 101 | |
| 102 | ] |
| 103 | ); |
| 104 | |
| 105 | $repeater = new Repeater(); |
| 106 | $repeater->add_control( |
| 107 | 'title1', |
| 108 | [ |
| 109 | 'label' => esc_html__( 'First Text', 'spider-elements' ), |
| 110 | 'type' => Controls_Manager::TEXT, |
| 111 | ] |
| 112 | ); |
| 113 | |
| 114 | $repeater->add_control( |
| 115 | 'title2', |
| 116 | [ |
| 117 | 'label' => esc_html__( 'Second Text', 'spider-elements' ), |
| 118 | 'type' => Controls_Manager::TEXT, |
| 119 | ] |
| 120 | ); |
| 121 | |
| 122 | |
| 123 | $this->add_control( |
| 124 | 'cd_option_list', |
| 125 | [ |
| 126 | 'label' => esc_html__( 'Slide List', 'spider-elements' ), |
| 127 | 'type' => Controls_Manager::REPEATER, |
| 128 | 'fields' => $repeater->get_controls(), |
| 129 | 'default' => [ |
| 130 | [ |
| 131 | 'title1' => esc_html__( 'Web', 'spider-elements' ), |
| 132 | 'title2' => esc_html__( 'Developer', 'spider-elements' ), |
| 133 | ], |
| 134 | [ |
| 135 | 'title1' => esc_html__( 'Web', 'spider-elements' ), |
| 136 | 'title2' => esc_html__( 'Professional Coder', 'spider-elements' ), |
| 137 | ], |
| 138 | [ |
| 139 | 'title1' => esc_html__( 'Web', 'spider-elements' ), |
| 140 | 'title2' => esc_html__( 'Developer', 'spider-elements' ), |
| 141 | ], |
| 142 | |
| 143 | ], |
| 144 | 'title_field' => '{{{ title2 }}}', |
| 145 | ] |
| 146 | ); |
| 147 | |
| 148 | $this->end_controls_section(); //End Filter |
| 149 | |
| 150 | } |
| 151 | |
| 152 | |
| 153 | /** |
| 154 | * Name: elementor_style_control() |
| 155 | * Desc: Register the Style Tab output on the Elementor editor. |
| 156 | * Params: no params |
| 157 | * Return: @void |
| 158 | * Since: @1.0.0 |
| 159 | * Package: @spider-elements |
| 160 | * Author: spider-themes |
| 161 | */ |
| 162 | public function elementor_style_control() { |
| 163 | |
| 164 | $this->start_controls_section( |
| 165 | 'style_animated_headline', |
| 166 | [ |
| 167 | 'label' => esc_html__( 'Animated Headline Style', 'spider-elements' ), |
| 168 | 'tab' => Controls_Manager::TAB_STYLE, |
| 169 | ] |
| 170 | ); |
| 171 | |
| 172 | //=== Before Title |
| 173 | $this->add_control( |
| 174 | 'se_before_title', |
| 175 | [ |
| 176 | 'label' => esc_html__( 'Before Title', 'spider-elements' ), |
| 177 | 'type' => Controls_Manager::HEADING, |
| 178 | 'separator' => 'before', |
| 179 | ] |
| 180 | ); |
| 181 | |
| 182 | $this->add_control( |
| 183 | 'se_b_t_color', |
| 184 | [ |
| 185 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 186 | 'type' => Controls_Manager::COLOR, |
| 187 | 'selectors' => [ |
| 188 | '{{WRAPPER}} h1.cd-headline' => 'color: {{VALUE}};', |
| 189 | ], |
| 190 | ] |
| 191 | ); |
| 192 | |
| 193 | $this->add_group_control( |
| 194 | Group_Control_Typography::get_type(), |
| 195 | [ |
| 196 | 'name' => 'se_b_t_color_typo', |
| 197 | 'selector' => '{{WRAPPER}} h1.cd-headline', |
| 198 | ] |
| 199 | ); //End Author Name |
| 200 | |
| 201 | //=== First Text Title |
| 202 | $this->add_control( |
| 203 | 'se_f_t_title', |
| 204 | [ |
| 205 | 'label' => esc_html__( 'First Text', 'spider-elements' ), |
| 206 | 'type' => Controls_Manager::HEADING, |
| 207 | 'separator' => 'before', |
| 208 | ] |
| 209 | ); |
| 210 | |
| 211 | $this->add_control( |
| 212 | 'se_f_t_title_color', |
| 213 | [ |
| 214 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 215 | 'type' => Controls_Manager::COLOR, |
| 216 | 'selectors' => [ |
| 217 | '{{WRAPPER}} .single-headline span b' => 'color: {{VALUE}};', |
| 218 | ], |
| 219 | ] |
| 220 | ); |
| 221 | |
| 222 | $this->add_group_control( |
| 223 | Group_Control_Typography::get_type(), |
| 224 | [ |
| 225 | 'name' => 'se_f_t_title_typo', |
| 226 | 'selector' => '{{WRAPPER}} .single-headline span b', |
| 227 | ] |
| 228 | ); |
| 229 | |
| 230 | //=== Second Text Title |
| 231 | $this->add_control( |
| 232 | 'se_s_t_title', |
| 233 | [ |
| 234 | 'label' => esc_html__( 'Second Text', 'spider-elements' ), |
| 235 | 'type' => Controls_Manager::HEADING, |
| 236 | 'separator' => 'before', |
| 237 | ] |
| 238 | ); |
| 239 | |
| 240 | $this->add_control( |
| 241 | 'se_s_t_title_color', |
| 242 | [ |
| 243 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 244 | 'type' => Controls_Manager::COLOR, |
| 245 | 'selectors' => [ |
| 246 | '{{WRAPPER}} span.is-visible' => 'color: {{VALUE}};', |
| 247 | ], |
| 248 | ] |
| 249 | ); |
| 250 | |
| 251 | $this->add_group_control( |
| 252 | Group_Control_Typography::get_type(), |
| 253 | [ |
| 254 | 'name' => 'se_s_t_title_typo', |
| 255 | 'selector' => '{{WRAPPER}} span.is-visible', |
| 256 | ] |
| 257 | ); //End Author Name |
| 258 | |
| 259 | $this->end_controls_tab(); |
| 260 | } |
| 261 | |
| 262 | /** |
| 263 | * Name: elementor_render() |
| 264 | * Desc: Render the widget output on the frontend. |
| 265 | * Params: no params |
| 266 | * Return: @void |
| 267 | * Since: @1.0.0 |
| 268 | * Package: @spider-elements |
| 269 | * Author: spider-themes |
| 270 | */ |
| 271 | protected function render() { |
| 272 | $settings = $this->get_settings_for_display(); |
| 273 | extract( $settings ); // extract all settings array to variables converted to name of key |
| 274 | ?> |
| 275 | <h1 class="cd-headline clip home-headline"> |
| 276 | <?php echo esc_html( $settings['headline_before_text'] ) ?> |
| 277 | <small class="cd-words-wrapper single-headline"> |
| 278 | <?php |
| 279 | $i = ""; |
| 280 | if ( ! empty( $cd_option_list ) ) { |
| 281 | foreach ( $cd_option_list as $item ) { |
| 282 | $vihi = $i == 1 ? 'visible' : 'hidden'; |
| 283 | $i ++; |
| 284 | $slide_title1 = ! empty( $item['title1'] ) ? $item['title1'] : ''; |
| 285 | $slide_title2 = ! empty( $item['title2'] ) ? $item['title2'] : ''; |
| 286 | ?> |
| 287 | <span class="is-<?php echo esc_attr( $vihi ); ?>"> |
| 288 | <?php |
| 289 | if ( $slide_title1 ) { ?> |
| 290 | <b><?php echo esc_attr( $slide_title1 ); ?></b> |
| 291 | <?php |
| 292 | } |
| 293 | if ( $slide_title2 ) { |
| 294 | echo esc_attr( $slide_title2 ); |
| 295 | } |
| 296 | ?> |
| 297 | </span> |
| 298 | <?php |
| 299 | } |
| 300 | } |
| 301 | ?> |
| 302 | </small> |
| 303 | </h1> |
| 304 | <?php |
| 305 | } |
| 306 | } |