| @@ -1,11 +1,14 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | namespace UiCoreElements\Utils; |
| 4 | + | |
| 3 | 5 | use Elementor\Controls_Manager; |
| 4 | 6 | |
| 5 | 7 | defined('ABSPATH') || exit(); |
| 6 | 8 | |
| 7 | -trait Animation_Trait { | |
| 9 | +trait Animation_Trait | |
| 10 | +{ | |
| 8 | 11 | |
| 9 | 12 | private $animation; |
| 10 | 13 | |
| 11 | 14 | /** |
| @@ -30,9 +33,9 @@ | ||
| 30 | 33 | |
| 31 | 34 | // Mandatory params |
| 32 | 35 | $params = [ |
| 33 | 36 | /* translators: %s: control title */ |
| 34 | - 'label' => esc_html( sprintf('%s', $name), 'uicore-elements'), | |
| 37 | + 'label' => esc_html(sprintf('%s', $name), 'uicore-elements'), | |
| 35 | 38 | 'type' => Controls_Manager::SELECT, |
| 36 | 39 | 'default' => '', |
| 37 | 40 | 'content_classes' => 'elementor-control-field-select-small', |
| 38 | 41 | 'options' => $this->uicore_get_animations($filter, $use_new), |
| @@ -38,12 +41,12 @@ | ||
| 38 | 41 | 'options' => $this->uicore_get_animations($filter, $use_new), |
| 39 | 42 | ]; |
| 40 | 43 | |
| 41 | 44 | // Optional params |
| 42 | - if( isset($conditions) ){ | |
| 45 | + if (isset($conditions)) { | |
| 43 | 46 | $params['condition'] = $conditions; |
| 44 | 47 | } |
| 45 | - if( isset($prefix_class) ) { | |
| 48 | + if (isset($prefix_class)) { | |
| 46 | 49 | $params['prefix_class'] = $prefix_class; |
| 47 | 50 | $params['render_type'] = 'template'; |
| 48 | 51 | } |
| 49 | 52 | |
| @@ -58,9 +61,9 @@ | ||
| 58 | 61 | 'label' => esc_html__('Animate each Item', 'uicore-elements'), |
| 59 | 62 | 'type' => Controls_Manager::SWITCHER, |
| 60 | 63 | 'default' => '', |
| 61 | 64 | 'return_value' => 'ui-e-grid-animate', |
| 62 | - 'render_type' => 'none', | |
| 65 | + 'render_type' => 'none', | |
| 63 | 66 | 'frontend_available' => true, |
| 64 | 67 | ] |
| 65 | 68 | ); |
| 66 | 69 | $this->add_control( |
| @@ -65,18 +68,18 @@ | ||
| 65 | 68 | ); |
| 66 | 69 | $this->add_control( |
| 67 | 70 | 'animate_item_type', |
| 68 | 71 | [ |
| 69 | - 'label' => __( 'Animation', 'uicore-elements' ), | |
| 72 | + 'label' => __('Animation', 'uicore-elements'), | |
| 70 | 73 | 'type' => Controls_Manager::SELECT, |
| 71 | 74 | 'default' => 'fadeInUp', |
| 72 | 75 | 'options' => [ |
| 73 | - 'fadeInUp' => __( 'Fade In Up', 'uicore-elements' ), | |
| 74 | - 'fadeInDown' => __( 'Fade In Down', 'uicore-elements' ), | |
| 75 | - 'fadeInLeft' => __( 'Fade In Left', 'uicore-elements' ), | |
| 76 | - 'fadeInRight' => __( 'Fade In Right', 'uicore-elements' ), | |
| 77 | - 'fadeIn' => __( 'Fade In', 'uicore-elements' ), | |
| 78 | - 'zoomIn' => __( 'Zoom In', 'uicore-elements' ), | |
| 76 | + 'fadeInUp' => __('Fade In Up', 'uicore-elements'), | |
| 77 | + 'fadeInDown' => __('Fade In Down', 'uicore-elements'), | |
| 78 | + 'fadeInLeft' => __('Fade In Left', 'uicore-elements'), | |
| 79 | + 'fadeInRight' => __('Fade In Right', 'uicore-elements'), | |
| 80 | + 'fadeIn' => __('Fade In', 'uicore-elements'), | |
| 81 | + 'zoomIn' => __('Zoom In', 'uicore-elements'), | |
| 79 | 82 | ], |
| 80 | 83 | 'condition' => array( |
| 81 | 84 | 'animate_items' => 'ui-e-grid-animate', |
| 82 | 85 | ), |
| @@ -85,14 +88,14 @@ | ||
| 85 | 88 | ); |
| 86 | 89 | $this->add_control( |
| 87 | 90 | 'animate_item_speed', |
| 88 | 91 | [ |
| 89 | - 'label' => __( 'Speed', 'uicore-elements' ), | |
| 92 | + 'label' => __('Speed', 'uicore-elements'), | |
| 90 | 93 | 'type' => Controls_Manager::SLIDER, |
| 91 | 94 | 'condition' => array( |
| 92 | 95 | 'animate_items' => 'ui-e-grid-animate', |
| 93 | 96 | ), |
| 94 | - 'default'=> [ | |
| 97 | + 'default' => [ | |
| 95 | 98 | 'unit' => 'px', |
| 96 | 99 | 'size' => 1500, |
| 97 | 100 | ], |
| 98 | 101 | 'range' => [ |
| @@ -108,12 +111,12 @@ | ||
| 108 | 111 | ] |
| 109 | 112 | ); |
| 110 | 113 | $this->add_control( |
| 111 | 114 | 'animate_item_delay', |
| 112 | - [ | |
| 113 | - 'label' => __( 'Animation Delay', 'uicore-elements' ), | |
| 115 | + [ | |
| 116 | + 'label' => __('Animation Delay', 'uicore-elements'), | |
| 114 | 117 | 'type' => Controls_Manager::SLIDER, |
| 115 | - 'default'=> [ | |
| 118 | + 'default' => [ | |
| 116 | 119 | 'unit' => 'px', |
| 117 | 120 | 'size' => 200, |
| 118 | 121 | ], |
| 119 | 122 | 'range' => [ |
| @@ -132,15 +135,15 @@ | ||
| 132 | 135 | ] |
| 133 | 136 | ); |
| 134 | 137 | $this->add_control( |
| 135 | 138 | 'animate_item_stagger', |
| 136 | - [ | |
| 137 | - 'label' => __( 'Stagger', 'uicore-elements' ), | |
| 139 | + [ | |
| 140 | + 'label' => __('Stagger', 'uicore-elements'), | |
| 138 | 141 | 'type' => Controls_Manager::SLIDER, |
| 139 | 142 | 'condition' => array( |
| 140 | 143 | 'animate_items' => 'ui-e-grid-animate', |
| 141 | 144 | ), |
| 142 | - 'default'=> [ | |
| 145 | + 'default' => [ | |
| 143 | 146 | 'unit' => 'px', |
| 144 | 147 | 'size' => 16, |
| 145 | 148 | ], |
| 146 | 149 | 'range' => [ |
| @@ -155,16 +158,16 @@ | ||
| 155 | 158 | ], |
| 156 | 159 | ] |
| 157 | 160 | ); |
| 158 | 161 | $this->add_control( |
| 159 | - 'hr', | |
| 160 | - [ | |
| 161 | - 'type' => \Elementor\Controls_Manager::DIVIDER, | |
| 162 | + 'hr', | |
| 163 | + [ | |
| 164 | + 'type' => \Elementor\Controls_Manager::DIVIDER, | |
| 162 | 165 | 'condition' => array( |
| 163 | 166 | 'animate_items' => 'ui-e-grid-animate', |
| 164 | 167 | ), |
| 165 | - ] | |
| 166 | - ); | |
| 168 | + ] | |
| 169 | + ); | |
| 167 | 170 | } |
| 168 | 171 | |
| 169 | 172 | /** |
| 170 | 173 | * Retrieves the animations list available for the widget. |
| @@ -192,9 +195,9 @@ | ||
| 192 | 195 | $list = []; |
| 193 | 196 | $animation_list = wp_parse_args($this->animation, $animation_list); |
| 194 | 197 | |
| 195 | 198 | // Add new animations if requested |
| 196 | - if( $use_new ){ | |
| 199 | + if ($use_new) { | |
| 197 | 200 | $animation_list = array_merge($animation_list, $new_animations); |
| 198 | 201 | } |
| 199 | 202 | |
| 200 | 203 | // Filter the list of animations |
| @@ -204,9 +207,9 @@ | ||
| 204 | 207 | |
| 205 | 208 | // Format the list of animations, with translated strings, to be used as elementor option's array |
| 206 | 209 | foreach ($animation_list as $key => $value) { |
| 207 | 210 | $slug = $key !== '' ? "ui-e-item-anim-$key" : ''; |
| 208 | - $list[$slug] = esc_html( sprintf('%s', $value), 'uicore-elements'); | |
| 211 | + $list[$slug] = esc_html(sprintf('%s', $value), 'uicore-elements'); | |
| 209 | 212 | } |
| 210 | 213 | |
| 211 | 214 | return $list; |
| 212 | 215 | } |
| @@ -236,5 +239,5 @@ | ||
| 236 | 239 | 'options' => $animations |
| 237 | 240 | ] |
| 238 | 241 | ); |
| 239 | 242 | } |
| 240 | -} | |
| 243 | +} | |