| @@ -24,9 +24,9 @@ | ||
| 24 | 24 | * @static |
| 25 | 25 | * |
| 26 | 26 | * @var array |
| 27 | 27 | */ |
| 28 | - protected static $_animations; | |
| 28 | + private static $_animations; | |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Get hover animation control type. |
| 32 | 32 | * |
| @@ -53,26 +53,47 @@ | ||
| 53 | 53 | * @return array Available hover animation. |
| 54 | 54 | */ |
| 55 | 55 | public static function get_animations() { |
| 56 | 56 | if ( is_null( self::$_animations ) ) { |
| 57 | - self::$_animations = self::get_default_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 | + ]; | |
| 58 | 86 | |
| 59 | 87 | $additional_animations = []; |
| 60 | - | |
| 61 | 88 | /** |
| 62 | - * Hover animations. | |
| 89 | + * Element hover animations list. | |
| 63 | 90 | * |
| 64 | - * Filters the animations list displayed in the hover animations control. | |
| 65 | - * | |
| 66 | - * This hook can be used to register new animations in addition to the | |
| 67 | - * basic Elementor hover animations. | |
| 68 | - * | |
| 69 | 91 | * @since 2.4.0 |
| 70 | 92 | * |
| 71 | - * @param array $additional_animations Additional animations array. | |
| 93 | + * @param array $additional_animations Additional Animations array. | |
| 72 | 94 | */ |
| 73 | 95 | $additional_animations = apply_filters( 'elementor/controls/hover_animations/additional_animations', $additional_animations ); |
| 74 | - | |
| 75 | 96 | self::$_animations = array_merge( self::$_animations, $additional_animations ); |
| 76 | 97 | } |
| 77 | 98 | |
| 78 | 99 | return self::$_animations; |
| @@ -77,40 +98,8 @@ | ||
| 77 | 98 | |
| 78 | 99 | return self::$_animations; |
| 79 | 100 | } |
| 80 | 101 | |
| 81 | - public static function get_default_animations(): array { | |
| 82 | - return [ | |
| 83 | - 'grow' => 'Grow', | |
| 84 | - 'shrink' => 'Shrink', | |
| 85 | - 'pulse' => 'Pulse', | |
| 86 | - 'pulse-grow' => 'Pulse Grow', | |
| 87 | - 'pulse-shrink' => 'Pulse Shrink', | |
| 88 | - 'push' => 'Push', | |
| 89 | - 'pop' => 'Pop', | |
| 90 | - 'bounce-in' => 'Bounce In', | |
| 91 | - 'bounce-out' => 'Bounce Out', | |
| 92 | - 'rotate' => 'Rotate', | |
| 93 | - 'grow-rotate' => 'Grow Rotate', | |
| 94 | - 'float' => 'Float', | |
| 95 | - 'sink' => 'Sink', | |
| 96 | - 'bob' => 'Bob', | |
| 97 | - 'hang' => 'Hang', | |
| 98 | - 'skew' => 'Skew', | |
| 99 | - 'skew-forward' => 'Skew Forward', | |
| 100 | - 'skew-backward' => 'Skew Backward', | |
| 101 | - 'wobble-vertical' => 'Wobble Vertical', | |
| 102 | - 'wobble-horizontal' => 'Wobble Horizontal', | |
| 103 | - 'wobble-to-bottom-right' => 'Wobble To Bottom Right', | |
| 104 | - 'wobble-to-top-right' => 'Wobble To Top Right', | |
| 105 | - 'wobble-top' => 'Wobble Top', | |
| 106 | - 'wobble-bottom' => 'Wobble Bottom', | |
| 107 | - 'wobble-skew' => 'Wobble Skew', | |
| 108 | - 'buzz' => 'Buzz', | |
| 109 | - 'buzz-out' => 'Buzz Out', | |
| 110 | - ]; | |
| 111 | - } | |
| 112 | - | |
| 113 | 102 | /** |
| 114 | 103 | * Render hover animation control output in the editor. |
| 115 | 104 | * |
| 116 | 105 | * Used to generate the control HTML in the editor using Underscore JS |
| @@ -126,9 +115,9 @@ | ||
| 126 | 115 | <label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label> |
| 127 | 116 | <div class="elementor-control-input-wrapper"> |
| 128 | 117 | <select id="<?php $this->print_control_uid(); ?>" data-setting="{{ data.name }}"> |
| 129 | 118 | <option value=""><?php echo esc_html__( 'None', 'elementor' ); ?></option> |
| 130 | - <?php foreach ( static::get_animations() as $animation_name => $animation_title ) : ?> | |
| 119 | + <?php foreach ( self::get_animations() as $animation_name => $animation_title ) : ?> | |
| 131 | 120 | <option value="<?php Utils::print_unescaped_internal_string( $animation_name ); ?>"><?php Utils::print_unescaped_internal_string( $animation_title ); ?></option> |
| 132 | 121 | <?php endforeach; ?> |
| 133 | 122 | </select> |
| 134 | 123 | </div> |
| @@ -161,8 +150,8 @@ | ||
| 161 | 150 | return []; |
| 162 | 151 | } |
| 163 | 152 | |
| 164 | 153 | return [ |
| 165 | - 'styles' => [ 'e-animation-' . $setting ], | |
| 154 | + 'styles' => [ 'e-animations' ], | |
| 166 | 155 | ]; |
| 167 | 156 | } |
| 168 | 157 | } |