first commit

This commit is contained in:
Ryan Ariana committed 2024-05-06 11:04:37 +07:00
commit aee061ddba
7322 files changed
+2918816

No files matched your search

@@ -0,0 +1 @@
{"v":"5.5.7","meta":{"g":"LottieFiles AE ","a":"","k":"","d":"","tc":""},"fr":25,"ip":0,"op":125,"w":1920,"h":1080,"nm":"InLogo 3","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 14","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":-90,"ix":10},"p":{"a":0,"k":[862,408,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[28.7,53,100],"ix":6}},"ao":0,"ef":[{"ty":5,"nm":"Turbulent Displace","np":16,"mn":"ADBE Turbulent Displace","ix":1,"en":1,"ef":[{"ty":7,"nm":"Displacement","mn":"ADBE Turbulent Displace-0001","ix":1,"v":{"a":0,"k":1,"ix":1}},{"ty":0,"nm":"Amount","mn":"ADBE Turbulent Displace-0002","ix":2,"v":{"a":0,"k":33,"ix":2}},{"ty":0,"nm":"Size","mn":"ADBE Turbulent Displace-0003","ix":3,"v":{"a":0,"k":90,"ix":3}},{"ty":3,"nm":"Offset (Turbulence)","mn":"ADBE Turbulent Displace-0004","ix":4,"v":{"a":0,"k":[960,540],"ix":4}},{"ty":0,"nm":"Complexity","mn":"ADBE Turbulent Displace-0005","ix":5,"v":{"a":0,"k":1,"ix":5}},{"ty":0,"nm":"Evolution","mn":"ADBE Turbulent Displace-0006","ix":6,"v":{"a":0,"k":0,"ix":6}},{"ty":6,"nm":"Evolution Options","mn":"ADBE Turbulent Displace-0007","ix":7,"v":0},{"ty":7,"nm":"Cycle Evolution","mn":"ADBE Turbulent Displace-0008","ix":8,"v":{"a":0,"k":0,"ix":8}},{"ty":0,"nm":"Cycle (in Revolutions)","mn":"ADBE Turbulent Displace-0009","ix":9,"v":{"a":0,"k":1,"ix":9}},{"ty":0,"nm":"Random Seed","mn":"ADBE Turbulent Displace-0010","ix":10,"v":{"a":0,"k":0,"ix":10}},{"ty":6,"nm":"Random Seed","mn":"ADBE Turbulent Displace-0011","ix":11,"v":0},{"ty":7,"nm":"Pinning","mn":"ADBE Turbulent Displace-0012","ix":12,"v":{"a":0,"k":3,"ix":12}},{"ty":7,"nm":"Resize Layer","mn":"ADBE Turbulent Displace-0013","ix":13,"v":{"a":0,"k":0,"ix":13}},{"ty":7,"nm":"Antialiasing for Best Quality","mn":"ADBE Turbulent Displace-0014","ix":14,"v":{"a":0,"k":1,"ix":14}}]}],"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"t":66.833,"s":[{"i":[[4.75,0.75],[1,-1.25],[-8,-0.25]],"o":[[-4.75,-0.75],[-1,1.25],[8,0.25]],"v":[[346.5,-0.25],[334.25,0.5],[341.75,4.25]],"c":true}],"h":1},{"t":68.5003255208333,"s":[{"i":[[1.286,0.48],[0.271,-0.799],[-2.167,-0.16]],"o":[[-1.286,-0.48],[-0.271,0.799],[2.167,0.16]],"v":[[352.589,0.471],[349.271,0.951],[351.302,3.348]],"c":true}],"h":1}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,0.482352941176,0.898039215686,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.482352941176,0.898039215686,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":66,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":66.833,"s":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":69.333,"s":[100]},{"t":70.1663411458333,"s":[0]}],"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 13","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":1,"k":[{"t":70.166,"s":[{"i":[[4.18,-0.372],[0.022,-1.823],[-6.574,0.303],[0.536,2.784]],"o":[[-4.18,0.372],[-0.03,2.442],[6.574,-0.303],[-0.604,-3.14]],"v":[[-510.668,-7.313],[-517.525,-0.891],[-508.861,4.275],[-501.457,-3.208]],"c":true}],"h":1},{"t":71.833,"s":[{"i":[[1.998,-0.14],[-0.044,-1.297],[-3.151,0.02],[0.341,1.997]],"o":[[-1.998,0.14],[0.058,1.737],[3.151,-0.02],[-0.384,-2.252]],"v":[[-518.552,-4.632],[-521.656,-0.268],[-517.355,3.533],[-511.502,-1.693]],"c":true}],"h":1},{"t":73.5003255208333,"s":[{"i":[[1.184,-0.136],[-0.026,-0.772],[-2.27,0.176],[0.203,1.189]],"o":[[-2.219,0.255],[0.035,1.034],[1.87,-0.145],[-0.229,-1.341]],"v":[[-521.063,-2.58],[-523.443,0.073],[-520.398,2.327],[-517.399,-0.776]],"c":true}],"h":1}],"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,0.482352941176,0.898039215686,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.482352941176,0.898039215686,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[830.5,-2.125],"ix":2},"a":{"a":0,"k":[-502,1],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":187.253,"ix":6},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":69.333,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":70.166,"s":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":74.333,"s":[100]},{"t":75.1663411458333,"s":[0]}],"ix":7},"sLine truncated
@@ -0,0 +1,77 @@
<?php
namespace ElementorPro\Modules\Lottie;
use ElementorPro\Base\Module_Base;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Module extends Module_Base {
public function __construct() {
parent::__construct();
add_filter( 'wp_check_filetype_and_ext', [ $this, 'handle_file_type' ], 10, 3 );
add_filter( 'elementor_pro/frontend/localize_settings', [ $this, 'localize_settings' ] );
add_action( 'elementor/frontend/before_register_scripts', [ $this, 'register_frontend_scripts' ] );
}
/**
* Get module name.
*
* Retrieve the module name.
*
* @since 2.7.0
* @access public
*
* @return string Module name.
*/
public function get_name() {
return 'lottie';
}
public function get_widgets() {
return [
'lottie',
];
}
// Fixing wordpress problem when `finfo_file()` returns wrong file type
public function handle_file_type( $file_data, $file, $filename ) {
if ( $file_data['ext'] && $file_data['type'] ) {
return $file_data;
}
$filetype = wp_check_filetype( $filename );
if ( 'json' === $filetype['ext'] ) {
$file_data['ext'] = 'json';
$file_data['type'] = 'application/json';
}
return $file_data;
}
public function register_frontend_scripts() {
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
wp_register_script(
'lottie',
ELEMENTOR_PRO_URL . 'assets/lib/lottie/lottie' . $suffix . '.js',
[
'jquery',
],
'5.6.6',
true
);
}
public function localize_settings( array $settings ) {
$settings['lottie']['defaultAnimationUrl'] = ELEMENTOR_PRO_MODULES_URL . 'lottie/assets/animations/default.json';
return $settings;
}
}
@@ -0,0 +1,875 @@
<?php
namespace ElementorPro\Modules\Lottie\Widgets;
use Elementor\Controls_Manager;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Group_Control_Css_Filter;
use Elementor\Group_Control_Typography;
use ElementorPro\Base\Base_Widget;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Lottie extends Base_Widget {
/**
* Get element name.
*
* Retrieve the element name.
*
* @return string The name.
* @since 2.7.0
* @access public
*
*/
public function get_name() {
return 'lottie';
}
public function get_title() {
return esc_html__( 'Lottie', 'elementor-pro' );
}
public function get_script_depends() {
return [ 'lottie' ];
}
public function get_style_depends() {
return [ 'e-lottie' ];
}
public function get_icon() {
return 'eicon-lottie';
}
protected function register_controls() {
$this->start_controls_section( 'lottie', [
'label' => esc_html__( 'Lottie', 'elementor-pro' ),
] );
$this->add_control(
'source',
[
'label' => esc_html__( 'Source', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'media_file',
'options' => [
'media_file' => esc_html__( 'Media File', 'elementor-pro' ),
'external_url' => esc_html__( 'External URL', 'elementor-pro' ),
],
'frontend_available' => true,
]
);
$this->add_control(
'source_external_url',
[
'label' => esc_html__( 'External URL', 'elementor-pro' ),
'type' => Controls_Manager::URL,
'condition' => [
'source' => 'external_url',
],
'dynamic' => [
'active' => true,
],
'placeholder' => esc_html__( 'Enter your URL', 'elementor-pro' ),
'frontend_available' => true,
]
);
$this->add_control(
'source_json',
[
'label' => esc_html__( 'Upload JSON File', 'elementor-pro' ),
'type' => Controls_Manager::MEDIA,
'media_types' => [ 'application/json' ],
'frontend_available' => true,
'condition' => [
'source' => 'media_file',
],
]
);
$this->add_responsive_control(
'align',
[
'label' => esc_html__( 'Alignment', 'elementor-pro' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'elementor-pro' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'elementor-pro' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'elementor-pro' ),
'icon' => 'eicon-text-align-right',
],
],
'prefix_class' => 'elementor%s-align-',
'default' => 'center',
]
);
$this->add_control(
'caption_source',
[
'label' => esc_html__( 'Caption', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'options' => [
'none' => esc_html__( 'None', 'elementor-pro' ),
'title' => esc_html__( 'Title', 'elementor-pro' ),
'caption' => esc_html__( 'Caption', 'elementor-pro' ),
'custom' => esc_html__( 'Custom', 'elementor-pro' ),
],
'condition' => [
'source!' => 'external_url',
'source_json[url]!' => '',
],
'frontend_available' => true,
]
);
$this->add_control(
'caption',
[
'label' => esc_html__( 'Custom Caption', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'render_type' => 'none',
'conditions' => [
'relation' => 'or',
'terms' => [
[
'name' => 'caption_source',
'value' => 'custom',
],
[
'name' => 'source',
'value' => 'external_url',
],
],
],
'dynamic' => [
'active' => true,
],
'frontend_available' => true,
]
);
$this->add_control(
'link_to',
[
'label' => esc_html__( 'Link', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'render_type' => 'none',
'default' => 'none',
'options' => [
'none' => esc_html__( 'None', 'elementor-pro' ),
'custom' => esc_html__( 'Custom URL', 'elementor-pro' ),
],
'frontend_available' => true,
]
);
$this->add_control(
'custom_link',
[
'label' => esc_html__( 'Link', 'elementor-pro' ),
'type' => Controls_Manager::URL,
'render_type' => 'none',
'placeholder' => esc_html__( 'Enter your URL', 'elementor-pro' ),
'condition' => [
'link_to' => 'custom',
],
'dynamic' => [
'active' => true,
],
'default' => [
'url' => '',
],
'show_label' => false,
'frontend_available' => true,
]
);
// lottie.
$this->end_controls_section();
$this->start_controls_section( 'settings', [
'label' => esc_html__( 'Settings', 'elementor-pro' ),
] );
$this->add_control(
'trigger',
[
'label' => esc_html__( 'Trigger', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'arriving_to_viewport',
'options' => [
'arriving_to_viewport' => esc_html__( 'Viewport', 'elementor-pro' ),
'on_click' => esc_html__( 'On Click', 'elementor-pro' ),
'on_hover' => esc_html__( 'On Hover', 'elementor-pro' ),
'bind_to_scroll' => esc_html__( 'Scroll', 'elementor-pro' ),
'none' => esc_html__( 'None', 'elementor-pro' ),
],
'frontend_available' => true,
]
);
$this->add_control(
'viewport',
[
'label' => esc_html__( 'Viewport', 'elementor-pro' ),
'type' => Controls_Manager::SLIDER,
'render_type' => 'none',
'conditions' => [
'relation' => 'or',
'terms' => [
[
'name' => 'trigger',
'operator' => '===',
'value' => 'arriving_to_viewport',
],
[
'name' => 'trigger',
'operator' => '===',
'value' => 'bind_to_scroll',
],
],
],
'default' => [
'sizes' => [
'start' => 0,
'end' => 100,
],
'unit' => '%',
],
'labels' => [
__( 'Bottom', 'elementor-pro' ),
__( 'Top', 'elementor-pro' ),
],
'scales' => 1,
'handles' => 'range',
'frontend_available' => true,
]
);
$this->add_control(
'effects_relative_to',
[
'label' => esc_html__( 'Effects Relative To', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'render_type' => 'none',
'condition' => [
'trigger' => 'bind_to_scroll',
],
'default' => 'viewport',
'options' => [
'viewport' => esc_html__( 'Viewport', 'elementor-pro' ),
'page' => esc_html__( 'Entire Page', 'elementor-pro' ),
],
'frontend_available' => true,
]
);
$this->add_control(
'loop',
[
'label' => esc_html__( 'Loop', 'elementor-pro' ),
'type' => Controls_Manager::SWITCHER,
'render_type' => 'none',
'condition' => [
'trigger!' => 'bind_to_scroll',
],
'return_value' => 'yes',
'default' => '',
'frontend_available' => true,
]
);
$this->add_control(
'number_of_times',
[
'label' => esc_html__( 'Times', 'elementor-pro' ),
'type' => Controls_Manager::NUMBER,
'render_type' => 'none',
'conditions' => [
'relation' => 'and',
'terms' => [
[
'name' => 'trigger',
'operator' => '!==',
'value' => 'bind_to_scroll',
],
[
'name' => 'loop',
'operator' => '===',
'value' => 'yes',
],
],
],
'min' => 0,
'step' => 1,
'frontend_available' => true,
]
);
$this->add_control(
'link_timeout',
[
'label' => esc_html__( 'Link Timeout', 'elementor-pro' ) . ' (ms)',
'type' => Controls_Manager::NUMBER,
'render_type' => 'none',
'conditions' => [
'relation' => 'and',
'terms' => [
[
'name' => 'link_to',
'operator' => '===',
'value' => 'custom',
],
[
'name' => 'trigger',
'operator' => '===',
'value' => 'on_click',
],
[
'name' => 'custom_link[url]',
'operator' => '!==',
'value' => '',
],
],
],
'description' => esc_html__( 'Redirect to link after selected timeout', 'elementor-pro' ),
'min' => 0,
'max' => 5000,
'step' => 1,
'frontend_available' => true,
]
);
$this->add_control(
'on_hover_out',
[
'label' => esc_html__( 'On Hover Out', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'render_type' => 'none',
'condition' => [
'trigger' => 'on_hover',
],
'default' => 'default',
'options' => [
'default' => esc_html__( 'Default', 'elementor-pro' ),
'reverse' => esc_html__( 'Reverse', 'elementor-pro' ),
'pause' => esc_html__( 'Pause', 'elementor-pro' ),
],
'frontend_available' => true,
]
);
$this->add_control(
'hover_area',
[
'label' => esc_html__( 'Hover Area', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'render_type' => 'none',
'condition' => [
'trigger' => 'on_hover',
],
'default' => 'animation',
'options' => [
'animation' => esc_html__( 'Animation', 'elementor-pro' ),
'column' => esc_html__( 'Column', 'elementor-pro' ),
'section' => esc_html__( 'Section', 'elementor-pro' ),
'container' => esc_html__( 'Container', 'elementor-pro' ),
],
'frontend_available' => true,
]
);
$this->add_control(
'play_speed',
[
'label' => esc_html__( 'Play Speed', 'elementor-pro' ) . ' (x)',
'type' => Controls_Manager::SLIDER,
'render_type' => 'none',
'condition' => [
'trigger!' => 'bind_to_scroll',
],
'default' => [
'size' => 1,
],
'range' => [
'px' => [
'min' => 0.1,
'max' => 5,
'step' => 0.1,
],
],
'size_units' => [ 'px' ],
'dynamic' => [
'active' => true,
],
'frontend_available' => true,
]
);
$this->add_control(
'start_point',
[
'label' => esc_html__( 'Start Point', 'elementor-pro' ),
'type' => Controls_Manager::SLIDER,
'frontend_available' => true,
'render_type' => 'none',
'default' => [
'size' => 0,
'unit' => '%',
],
'size_units' => [ '%' ],
]
);
$this->add_control(
'end_point',
[
'label' => esc_html__( 'End Point', 'elementor-pro' ),
'type' => Controls_Manager::SLIDER,
'frontend_available' => true,
'render_type' => 'none',
'default' => [
'size' => 100,
'unit' => '%',
],
'size_units' => [ '%' ],
]
);
$this->add_control(
'reverse_animation',
[
'label' => esc_html__( 'Reverse', 'elementor-pro' ),
'type' => Controls_Manager::SWITCHER,
'render_type' => 'none',
'conditions' => [
'relation' => 'and',
'terms' => [
[
'name' => 'trigger',
'operator' => '!==',
'value' => 'bind_to_scroll',
],
[
'name' => 'trigger',
'operator' => '!==',
'value' => 'on_hover',
],
],
],
'return_value' => 'yes',
'default' => '',
'frontend_available' => true,
]
);
$this->add_control(
'renderer',
[
'label' => esc_html__( 'Renderer', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'svg',
'options' => [
'svg' => esc_html__( 'SVG', 'elementor-pro' ),
'canvas' => esc_html__( 'Canvas', 'elementor-pro' ),
],
'separator' => 'before',
'frontend_available' => true,
]
);
$this->add_control(
'lazyload',
[
'label' => esc_html__( 'Lazy Load', 'elementor-pro' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'yes',
'default' => '',
'frontend_available' => true,
]
);
// Settings.
$this->end_controls_section();
$this->start_controls_section(
'style',
[
'label' => esc_html__( 'Lottie', 'elementor-pro' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'width',
[
'label' => esc_html__( 'Width', 'elementor-pro' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
'default' => [
'unit' => '%',
],
'tablet_default' => [
'unit' => '%',
],
'mobile_default' => [
'unit' => '%',
],
'range' => [
'%' => [
'min' => 1,
'max' => 100,
],
'px' => [
'min' => 1,
'max' => 1000,
],
'em' => [
'max' => 100,
],
'rem' => [
'max' => 100,
],
'vw' => [
'min' => 1,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}}' => '--lottie-container-width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'space',
[
'label' => esc_html__( 'Max Width', 'elementor-pro' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
'default' => [
'unit' => '%',
],
'tablet_default' => [
'unit' => '%',
],
'mobile_default' => [
'unit' => '%',
],
'range' => [
'%' => [
'min' => 1,
'max' => 100,
],
'px' => [
'min' => 1,
'max' => 1000,
],
'em' => [
'max' => 100,
],
'rem' => [
'max' => 100,
],
'vw' => [
'min' => 1,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}}' => '--lottie-container-max-width: {{SIZE}}{{UNIT}};',
],
'separator' => 'after',
]
);
$this->start_controls_tabs( 'image_effects' );
$this->start_controls_tab( 'normal',
[
'label' => esc_html__( 'Normal', 'elementor-pro' ),
]
);
$this->add_control(
'opacity',
[
'label' => esc_html__( 'Opacity', 'elementor-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 1,
'min' => 0.10,
'step' => 0.01,
],
],
'selectors' => [
'{{WRAPPER}}' => '--lottie-container-opacity: {{SIZE}};',
],
]
);
$this->add_group_control(
Group_Control_Css_Filter::get_type(),
[
'name' => 'css_filters',
'selector' => '{{WRAPPER}} .e-lottie__container',
]
);
// Normal.
$this->end_controls_tab();
$this->start_controls_tab( 'hover',
[
'label' => esc_html__( 'Hover', 'elementor-pro' ),
]
);
$this->add_control(
'opacity_hover',
[
'label' => esc_html__( 'Opacity', 'elementor-pro' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 1,
'min' => 0.10,
'step' => 0.01,
],
],
'selectors' => [
'{{WRAPPER}}' => '--lottie-container-opacity-hover: {{SIZE}};',
],
]
);
$this->add_group_control(
Group_Control_Css_Filter::get_type(),
[
'name' => 'css_filters_hover',
'selector' => '{{WRAPPER}} .e-lottie__container:hover',
]
);
$this->add_control(
'background_hover_transition',
[
'label' => esc_html__( 'Transition Duration', 'elementor-pro' ) . ' (s)',
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 3,
'step' => 0.1,
],
],
'selectors' => [
'{{WRAPPER}}' => '--lottie-container-transition-duration-hover: {{SIZE}}s',
],
]
);
// Hover.
$this->end_controls_tab();
// Image effects.
$this->end_controls_tabs();
// lottie style.
$this->end_controls_section();
$this->start_controls_section(
'section_style_caption',
[
'label' => esc_html__( 'Caption', 'elementor-pro' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'caption_source!' => 'none',
],
]
);
$this->add_control(
'caption_align',
[
'label' => esc_html__( 'Alignment', 'elementor-pro' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'elementor-pro' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'elementor-pro' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'elementor-pro' ),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'center',
'selectors' => [
'{{WRAPPER}}' => '--caption-text-align: {{VALUE}};',
],
]
);
$this->add_control(
'text_color',
[
'label' => esc_html__( 'Text Color', 'elementor-pro' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}}' => '--caption-color: {{VALUE}};',
],
'global' => [
'default' => Global_Colors::COLOR_TEXT,
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'caption_typography',
'selector' => '{{WRAPPER}} .e-lottie__caption',
'global' => [
'default' => Global_Typography::TYPOGRAPHY_TEXT,
],
]
);
$this->add_responsive_control(
'caption_space',
[
'label' => esc_html__( 'Spacing', 'elementor-pro' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'em', 'rem', 'custom' ],
'range' => [
'px' => [
'max' => 100,
],
'em' => [
'max' => 10,
],
'rem' => [
'max' => 10,
],
],
'selectors' => [
'{{WRAPPER}}' => '--caption-margin-top: {{SIZE}}{{UNIT}};',
],
]
);
$this->end_controls_section();
}
private function get_caption( $settings ) {
$is_media_file_caption = $this->is_media_file_caption( $settings );
$is_external_url_caption = $this->is_external_url_caption( $settings );
if ( ( $is_media_file_caption && 'custom' === $settings['caption_source'] ) || $is_external_url_caption ) {
return $settings['caption'];
} else if ( 'caption' === $settings['caption_source'] ) {
return wp_get_attachment_caption( $settings['source_json']['id'] );
} else if ( 'title' === $settings['caption_source'] ) {
return get_the_title( $settings['source_json']['id'] );
}
return '';
}
private function is_media_file_caption( $settings ) {
return 'media_file' === $settings['source'] && 'none' !== $settings['caption_source'];
}
private function is_external_url_caption( $settings ) {
return 'external_url' === $settings['source'] && '' !== $settings['caption'];
}
protected function render() {
$settings = $this->get_settings_for_display();
$caption = $this->get_caption( $settings );
$widget_caption = $caption ? '<p class="e-lottie__caption"> ' . esc_html( $caption ) . '</p>' : '';
$widget_container = '<div class="e-lottie__container"><div class="e-lottie__animation"></div>' . $widget_caption . '</div>';
if ( ! empty( $settings['custom_link']['url'] ) && 'custom' === $settings['link_to'] ) {
$this->add_link_attributes( 'url', $settings['custom_link'] );
$widget_container = sprintf( '<a class="e-lottie__container__link" %1$s>%2$s</a>', $this->get_render_attribute_string( 'url' ), $widget_container );
}
// PHPCS - XSS ok. Everything that should be escaped in the way is escaped.
echo $widget_container; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
protected function content_template() {
?>
<#
var ensureAttachmentData = function( id, type ) {
if ( 'caption' === type || 'title' === type ) {
if ( 'undefined' === typeof wp.media.attachment( id ).get( type ) ) {
wp.media.attachment( id ).fetch().then( function( data ) {
view.render();
} );
}
}
};
var getAttachmentData = function( id, type ) {
if ( id && ( 'caption' === type || 'title' === type ) ) {
ensureAttachmentData( id, type );
return wp.media.attachment( id ).get( type );
}
return '';
};
var getCaption = function() {
if ( ( isMediaFileCaption() && 'custom' === settings.caption_source ) || isExternalUrlCaption() ) {
return settings.caption;
} else if ( 'caption' === settings.caption_source || 'title' === settings.caption_source ) {
return getAttachmentData( settings.source_json.id, settings.caption_source );
}
return '';
};
var isMediaFileCaption = function() {
return 'media_file' === settings.source && 'none' !== settings.caption_source;
};
var isExternalUrlCaption = function() {
return 'external_url' === settings.source && '' !== settings.caption;
};
var widget_caption = getCaption() ? '<p class="e-lottie__caption">' + getCaption() + '</p>' : '';
var widget_container = '<div class="e-lottie__container"><div class="e-lottie__animation"></div>' + widget_caption + '</div>';
if ( settings.custom_link.url && 'custom' === settings.link_to ) {
widget_container = '<a class="e-lottie__container__link" href="' + _.escape( settings.custom_link.url ) + '">' + widget_container + '</a>';
}
print( widget_container );
#>
<?php
}
}