| @@ -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 |
| @@ -120,16 +109,17 @@ | ||
| 120 | 109 | * @since 1.0.0 |
| 121 | 110 | * @access public |
| 122 | 111 | */ |
| 123 | 112 | public function content_template() { |
| 113 | + $control_uid = $this->get_control_uid(); | |
| 124 | 114 | ?> |
| 125 | 115 | <div class="elementor-control-field"> |
| 126 | - <label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label> | |
| 116 | + <label for="<?php echo $control_uid; ?>" class="elementor-control-title">{{{ data.label }}}</label> | |
| 127 | 117 | <div class="elementor-control-input-wrapper"> |
| 128 | - <select id="<?php $this->print_control_uid(); ?>" data-setting="{{ data.name }}"> | |
| 129 | - <option value=""><?php echo esc_html__( 'None', 'elementor' ); ?></option> | |
| 130 | - <?php foreach ( static::get_animations() as $animation_name => $animation_title ) : ?> | |
| 131 | - <option value="<?php Utils::print_unescaped_internal_string( $animation_name ); ?>"><?php Utils::print_unescaped_internal_string( $animation_title ); ?></option> | |
| 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> | |
| 132 | 122 | <?php endforeach; ?> |
| 133 | 123 | </select> |
| 134 | 124 | </div> |
| 135 | 125 | </div> |
| @@ -152,17 +142,7 @@ | ||
| 152 | 142 | */ |
| 153 | 143 | protected function get_default_settings() { |
| 154 | 144 | return [ |
| 155 | 145 | 'label_block' => true, |
| 156 | - ]; | |
| 157 | - } | |
| 158 | - | |
| 159 | - public static function get_assets( $setting ) { | |
| 160 | - if ( ! $setting || 'none' === $setting ) { | |
| 161 | - return []; | |
| 162 | - } | |
| 163 | - | |
| 164 | - return [ | |
| 165 | - 'styles' => [ 'e-animation-' . $setting ], | |
| 166 | 146 | ]; |
| 167 | 147 | } |
| 168 | 148 | } |