| 1 |
<?php |
| 2 |
|
| 3 |
namespace Amedea\Widgets; |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
use \Elementor\Widget_Base; |
| 8 |
|
| 9 |
use \Elementor\Controls_Manager; |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
/** |
| 14 |
|
| 15 |
* Elementor |
| 16 |
|
| 17 |
* |
| 18 |
|
| 19 |
* Elementor widget |
| 20 |
|
| 21 |
* |
| 22 |
|
| 23 |
* @since 1.0.0 |
| 24 |
|
| 25 |
*/ |
| 26 |
|
| 27 |
class amedea__split_header extends Widget_Base { |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
/** |
| 32 |
|
| 33 |
* Retrieve the widget name. |
| 34 |
|
| 35 |
* |
| 36 |
|
| 37 |
* @since 1.0.0 |
| 38 |
|
| 39 |
* |
| 40 |
|
| 41 |
* @access public |
| 42 |
|
| 43 |
* |
| 44 |
|
| 45 |
* @return string Widget name. |
| 46 |
|
| 47 |
*/ |
| 48 |
|
| 49 |
public function get_name() { |
| 50 |
|
| 51 |
return 'split_header'; |
| 52 |
|
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
/** |
| 58 |
|
| 59 |
* Retrieve the widget title. |
| 60 |
|
| 61 |
* |
| 62 |
|
| 63 |
* @since 1.0.0 |
| 64 |
|
| 65 |
* |
| 66 |
|
| 67 |
* @access public |
| 68 |
|
| 69 |
* |
| 70 |
|
| 71 |
* @return string Widget title. |
| 72 |
|
| 73 |
*/ |
| 74 |
|
| 75 |
public function get_title() { |
| 76 |
|
| 77 |
return esc_html__( 'Split Header', 'amedea' ); |
| 78 |
|
| 79 |
} |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
/** |
| 84 |
|
| 85 |
* Retrieve the widget icon. |
| 86 |
|
| 87 |
* |
| 88 |
|
| 89 |
* @since 1.0.0 |
| 90 |
|
| 91 |
* |
| 92 |
|
| 93 |
* @access public |
| 94 |
|
| 95 |
* |
| 96 |
|
| 97 |
* @return string Widget icon. |
| 98 |
|
| 99 |
*/ |
| 100 |
|
| 101 |
public function get_icon() { |
| 102 |
|
| 103 |
return 'eicon-user-preferences'; |
| 104 |
|
| 105 |
} |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
/** |
| 110 |
|
| 111 |
* Retrieve the list of scripts the widget depended on. |
| 112 |
|
| 113 |
* |
| 114 |
|
| 115 |
* Used to set scripts dependencies required to run the widget. |
| 116 |
|
| 117 |
* |
| 118 |
|
| 119 |
* @since 1.0.0 |
| 120 |
|
| 121 |
* |
| 122 |
|
| 123 |
* @access public |
| 124 |
|
| 125 |
* |
| 126 |
|
| 127 |
* @return array Widget scripts dependencies. |
| 128 |
|
| 129 |
*/ |
| 130 |
|
| 131 |
public function get_script_depends() { |
| 132 |
|
| 133 |
return [ 'gsap' , 'scrolltrigger' , 'scrollsmoother' , 'amedea-split-header' ]; |
| 134 |
|
| 135 |
} |
| 136 |
|
| 137 |
/** |
| 138 |
|
| 139 |
* Retrieve the list of categories the widget belongs to. |
| 140 |
|
| 141 |
* |
| 142 |
|
| 143 |
* Used to determine where to display the widget in the editor. |
| 144 |
|
| 145 |
* |
| 146 |
|
| 147 |
* Note that currently Elementor supports only one category. |
| 148 |
|
| 149 |
* When multiple categories passed, Elementor uses the first one. |
| 150 |
|
| 151 |
* |
| 152 |
|
| 153 |
* @since 1.0.0 |
| 154 |
|
| 155 |
* |
| 156 |
|
| 157 |
* @access public |
| 158 |
|
| 159 |
* |
| 160 |
|
| 161 |
* @return array Widget categories. |
| 162 |
|
| 163 |
*/ |
| 164 |
|
| 165 |
public function get_categories() { |
| 166 |
|
| 167 |
return [ 'amedea-category' , 'amedea-theme-widgets-category' ]; |
| 168 |
|
| 169 |
} |
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
/** |
| 176 |
|
| 177 |
* Register the widget controls. |
| 178 |
|
| 179 |
* |
| 180 |
|
| 181 |
* Adds different input fields to allow the user to change and customize the widget settings. |
| 182 |
|
| 183 |
* |
| 184 |
|
| 185 |
* @since 1.0.0 |
| 186 |
|
| 187 |
* |
| 188 |
|
| 189 |
* @access protected |
| 190 |
|
| 191 |
*/ |
| 192 |
|
| 193 |
protected function register_controls() { |
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
$this->start_controls_section( |
| 198 |
|
| 199 |
'section_content0', |
| 200 |
|
| 201 |
[ |
| 202 |
|
| 203 |
'label' => esc_html__( 'Color', 'amedea' ), |
| 204 |
|
| 205 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 206 |
|
| 207 |
] |
| 208 |
|
| 209 |
); |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
$this->add_control( |
| 214 |
|
| 215 |
'style', |
| 216 |
|
| 217 |
array( |
| 218 |
|
| 219 |
'label' => esc_html__('Text Color', 'amedea'), |
| 220 |
|
| 221 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 222 |
|
| 223 |
'default' => 'dark', |
| 224 |
|
| 225 |
'label_block' => true, |
| 226 |
|
| 227 |
'options' => array( |
| 228 |
|
| 229 |
'light' => esc_html__('Light', 'amedea'), |
| 230 |
|
| 231 |
'dark' => esc_html__('Dark', 'amedea'), |
| 232 |
|
| 233 |
) |
| 234 |
|
| 235 |
) |
| 236 |
|
| 237 |
); |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
$this->end_controls_section(); |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
$this->start_controls_section( |
| 246 |
|
| 247 |
'section_content', |
| 248 |
|
| 249 |
[ |
| 250 |
|
| 251 |
'label' => esc_html__( 'Content', 'amedea' ), |
| 252 |
|
| 253 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 254 |
|
| 255 |
] |
| 256 |
|
| 257 |
); |
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
$this->add_control( |
| 262 |
|
| 263 |
'image', |
| 264 |
|
| 265 |
[ |
| 266 |
|
| 267 |
'label' => __( 'Image', 'amedea' ), |
| 268 |
|
| 269 |
'type' => \Elementor\Controls_Manager::MEDIA, |
| 270 |
|
| 271 |
'default' => [ 'url' => \Elementor\Utils::get_placeholder_image_src() ], |
| 272 |
|
| 273 |
] ); |
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
$this->end_controls_section(); |
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
} |
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
/** |
| 288 |
|
| 289 |
* Render the widget output on the frontend. |
| 290 |
|
| 291 |
* |
| 292 |
|
| 293 |
* Written in PHP and used to generate the final HTML. |
| 294 |
|
| 295 |
* |
| 296 |
|
| 297 |
* @since 1.0.0 |
| 298 |
|
| 299 |
* |
| 300 |
|
| 301 |
* @access protected |
| 302 |
|
| 303 |
*/ |
| 304 |
|
| 305 |
protected function render() { |
| 306 |
|
| 307 |
$settings = $this->get_settings_for_display(); |
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
?> |
| 314 |
|
| 315 |
<section id="split-header__wrapper"> |
| 316 |
|
| 317 |
<section id="split-header__content"> |
| 318 |
|
| 319 |
<div class="split-header__hero"> |
| 320 |
|
| 321 |
<div class="split-header__hero__inner constrain"> |
| 322 |
|
| 323 |
<div class="split-header__hero__image-cont"> |
| 324 |
|
| 325 |
<img src="<?php echo esc_url($settings['image']['url']); ?>" /> |
| 326 |
|
| 327 |
<div class="split-header__anim-swipe"></div> |
| 328 |
|
| 329 |
</div> |
| 330 |
|
| 331 |
<div class="split-header__hero__image-cont"> |
| 332 |
|
| 333 |
<img src="<?php echo esc_url($settings['image']['url']); ?>" /> |
| 334 |
|
| 335 |
<div class="split-header__anim-swipe"></div> |
| 336 |
|
| 337 |
</div> |
| 338 |
|
| 339 |
<div class="split-header__hero__image-cont"> |
| 340 |
|
| 341 |
<img src="<?php echo esc_url($settings['image']['url']); ?>" /> |
| 342 |
|
| 343 |
<div class="split-header__anim-swipe"></div> |
| 344 |
|
| 345 |
</div> |
| 346 |
|
| 347 |
<div class="split-header__hero__image-cont"> |
| 348 |
|
| 349 |
<img src="<?php echo esc_url($settings['image']['url']); ?>" /> |
| 350 |
|
| 351 |
<div class="split-header__anim-swipe"></div> |
| 352 |
|
| 353 |
</div> |
| 354 |
|
| 355 |
<div class="split-header__hero__image-cont"> |
| 356 |
|
| 357 |
<img src="<?php echo esc_url($settings['image']['url']); ?>" /> |
| 358 |
|
| 359 |
<div class="split-header__anim-swipe"></div> |
| 360 |
|
| 361 |
</div> |
| 362 |
|
| 363 |
<div class="split-header__hero__image-cont"> |
| 364 |
|
| 365 |
<img src="<?php echo esc_url($settings['image']['url']); ?>" /> |
| 366 |
|
| 367 |
<div class="split-header__anim-swipe"></div> |
| 368 |
|
| 369 |
</div> |
| 370 |
|
| 371 |
</div> |
| 372 |
|
| 373 |
</div> |
| 374 |
|
| 375 |
<!--<div class="split-header__spacer"></div>--> |
| 376 |
|
| 377 |
</section> |
| 378 |
|
| 379 |
<div class="require-gsap">Please, update the version from <a href="https://amedeapro.com/api/amedea.php?file=amedea&token=617070c76e2321567fdd713532c9afca" target="_blank">this link</a>. This version requires GSAP which is not included to WordPress.Org Version.</div> |
| 380 |
|
| 381 |
</section> |
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
<?php |
| 386 |
|
| 387 |
} |
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
/** |
| 392 |
|
| 393 |
* Render the widget output in the editor. |
| 394 |
|
| 395 |
* |
| 396 |
|
| 397 |
* Written as a Backbone JavaScript template and used to generate the live preview. |
| 398 |
|
| 399 |
* |
| 400 |
|
| 401 |
* @since 1.0.0 |
| 402 |
|
| 403 |
* |
| 404 |
|
| 405 |
* @access protected |
| 406 |
|
| 407 |
*/ |
| 408 |
|
| 409 |
protected function content_template() {} |
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
} |
| 414 |
|
| 415 |
|