PluginProbe
Elementor Website Builder – more than just a page builder / 3.2.4
Elementor Website Builder – more than just a page builder v3.2.4
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / includes / controls / hover-animation.php

hover-animation.php in Elementor Website Builder – more than just a page builder 3.2.4, at includes/controls/hover-animation.php

149 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly.
6 }
7
8 /**
9 * Elementor hover animation control.
10 *
11 * A base control for creating hover animation control. Displays a select box
12 * with the available hover animation effects @see Control_Hover_Animation::get_animations()
13 *
14 * @since 1.0.0
15 */
16 class Control_Hover_Animation extends Base_Data_Control {
17
18 /**
19 * Animations.
20 *
21 * Holds all the available hover animation effects of the control.
22 *
23 * @access private
24 * @static
25 *
26 * @var array
27 */
28 private static $_animations;
29
30 /**
31 * Get hover animation control type.
32 *
33 * Retrieve the control type, in this case `hover_animation`.
34 *
35 * @since 1.0.0
36 * @access public
37 *
38 * @return string Control type.
39 */
40 public function get_type() {
41 return 'hover_animation';
42 }
43
44 /**
45 * Get animations.
46 *
47 * Retrieve the available hover animation effects.
48 *
49 * @since 1.0.0
50 * @access public
51 * @static
52 *
53 * @return array Available hover animation.
54 */
55 public static function get_animations() {
56 if ( is_null( self::$_animations ) ) {
57 self::$_animations = [
58 'grow' => 'Grow',
59 'shrink' => 'Shrink',
60 'pulse' => 'Pulse',
61 'pulse-grow' => 'Pulse Grow',
62 'pulse-shrink' => 'Pulse Shrink',
63 'push' => 'Push',
64 'pop' => 'Pop',
65 'bounce-in' => 'Bounce In',
66 'bounce-out' => 'Bounce Out',
67 'rotate' => 'Rotate',
68 'grow-rotate' => 'Grow Rotate',
69 'float' => 'Float',
70 'sink' => 'Sink',
71 'bob' => 'Bob',
72 'hang' => 'Hang',
73 'skew' => 'Skew',
74 'skew-forward' => 'Skew Forward',
75 'skew-backward' => 'Skew Backward',
76 'wobble-vertical' => 'Wobble Vertical',
77 'wobble-horizontal' => 'Wobble Horizontal',
78 'wobble-to-bottom-right' => 'Wobble To Bottom Right',
79 'wobble-to-top-right' => 'Wobble To Top Right',
80 'wobble-top' => 'Wobble Top',
81 'wobble-bottom' => 'Wobble Bottom',
82 'wobble-skew' => 'Wobble Skew',
83 'buzz' => 'Buzz',
84 'buzz-out' => 'Buzz Out',
85 ];
86
87 $additional_animations = [];
88 /**
89 * Element hover animations list.
90 *
91 * @since 2.4.0
92 *
93 * @param array $additional_animations Additional Animations array.
94 */
95 $additional_animations = apply_filters( 'elementor/controls/hover_animations/additional_animations', $additional_animations );
96 self::$_animations = array_merge( self::$_animations, $additional_animations );
97 }
98
99 return self::$_animations;
100 }
101
102 /**
103 * Render hover animation control output in the editor.
104 *
105 * Used to generate the control HTML in the editor using Underscore JS
106 * template. The variables for the class are available using `data` JS
107 * object.
108 *
109 * @since 1.0.0
110 * @access public
111 */
112 public function content_template() {
113 $control_uid = $this->get_control_uid();
114 ?>
115 <div class="elementor-control-field">
116 <label for="<?php echo $control_uid; ?>" class="elementor-control-title">{{{ data.label }}}</label>
117 <div class="elementor-control-input-wrapper">
118 <select id="<?php echo $control_uid; ?>" data-setting="{{ data.name }}">
119 <option value=""><?php echo __( 'None', 'elementor' ); ?></option>
120 <?php foreach ( self::get_animations() as $animation_name => $animation_title ) : ?>
121 <option value="<?php echo $animation_name; ?>"><?php echo $animation_title; ?></option>
122 <?php endforeach; ?>
123 </select>
124 </div>
125 </div>
126 <# if ( data.description ) { #>
127 <div class="elementor-control-field-description">{{{ data.description }}}</div>
128 <# } #>
129 <?php
130 }
131
132 /**
133 * Get hover animation control default settings.
134 *
135 * Retrieve the default settings of the hover animation control. Used to return
136 * the default settings while initializing the hover animation control.
137 *
138 * @since 1.0.0
139 * @access protected
140 *
141 * @return array Control default settings.
142 */
143 protected function get_default_settings() {
144 return [
145 'label_block' => true,
146 ];
147 }
148 }
149