| @@ -1,10 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | -use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager; | |
| 5 | -use Elementor\Modules\DynamicTags\Module as TagsModule; | |
| 6 | - | |
| 7 | 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | 5 | exit; // Exit if accessed directly. |
| 9 | 6 | } |
| 10 | 7 | |
| @@ -91,21 +88,21 @@ | ||
| 91 | 88 | */ |
| 92 | 89 | private static function get_default_background_types() { |
| 93 | 90 | return [ |
| 94 | 91 | 'classic' => [ |
| 95 | - 'title' => esc_html__( 'Classic', 'elementor' ), | |
| 92 | + 'title' => _x( 'Classic', 'Background Control', 'elementor' ), | |
| 96 | 93 | 'icon' => 'eicon-paint-brush', |
| 97 | 94 | ], |
| 98 | 95 | 'gradient' => [ |
| 99 | - 'title' => esc_html__( 'Gradient', 'elementor' ), | |
| 96 | + 'title' => _x( 'Gradient', 'Background Control', 'elementor' ), | |
| 100 | 97 | 'icon' => 'eicon-barcode', |
| 101 | 98 | ], |
| 102 | 99 | 'video' => [ |
| 103 | - 'title' => esc_html__( 'Video', 'elementor' ), | |
| 100 | + 'title' => _x( 'Video', 'Background Control', 'elementor' ), | |
| 104 | 101 | 'icon' => 'eicon-video-camera', |
| 105 | 102 | ], |
| 106 | 103 | 'slideshow' => [ |
| 107 | - 'title' => esc_html__( 'Slideshow', 'elementor' ), | |
| 104 | + 'title' => _x( 'Slideshow', 'Background Control', 'elementor' ), | |
| 108 | 105 | 'icon' => 'eicon-slideshow', |
| 109 | 106 | ], |
| 110 | 107 | ]; |
| 111 | 108 | } |
| @@ -120,77 +117,37 @@ | ||
| 120 | 117 | * |
| 121 | 118 | * @return array Control fields. |
| 122 | 119 | */ |
| 123 | 120 | public function init_fields() { |
| 124 | - $active_breakpoints = Plugin::$instance->breakpoints->get_active_breakpoints(); | |
| 125 | - | |
| 126 | - $location_device_args = []; | |
| 127 | - $location_device_defaults = [ | |
| 128 | - 'default' => [ | |
| 129 | - 'unit' => '%', | |
| 130 | - ], | |
| 131 | - ]; | |
| 132 | - | |
| 133 | - $angel_device_args = []; | |
| 134 | - $angel_device_defaults = [ | |
| 135 | - 'default' => [ | |
| 136 | - 'unit' => 'deg', | |
| 137 | - ], | |
| 138 | - ]; | |
| 139 | - | |
| 140 | - $position_device_args = []; | |
| 141 | - $position_device_defaults = [ | |
| 142 | - 'default' => 'center center', | |
| 143 | - ]; | |
| 144 | - | |
| 145 | - foreach ( $active_breakpoints as $breakpoint_name => $breakpoint ) { | |
| 146 | - $location_device_args[ $breakpoint_name ] = $location_device_defaults; | |
| 147 | - $angel_device_args[ $breakpoint_name ] = $angel_device_defaults; | |
| 148 | - $position_device_args[ $breakpoint_name ] = $position_device_defaults; | |
| 149 | - } | |
| 150 | - | |
| 151 | 121 | $fields = []; |
| 152 | 122 | |
| 153 | 123 | $fields['background'] = [ |
| 154 | - 'label' => esc_html__( 'Background Type', 'elementor' ), | |
| 124 | + 'label' => _x( 'Background Type', 'Background Control', 'elementor' ), | |
| 155 | 125 | 'type' => Controls_Manager::CHOOSE, |
| 156 | 126 | 'render_type' => 'ui', |
| 157 | 127 | ]; |
| 158 | 128 | |
| 159 | - $fields['gradient_notice'] = [ | |
| 160 | - 'type' => Controls_Manager::ALERT, | |
| 161 | - 'alert_type' => 'warning', | |
| 162 | - 'content' => esc_html__( 'Set locations and angle for each breakpoint to ensure the gradient adapts to different screen sizes.', 'elementor' ), | |
| 163 | - 'render_type' => 'ui', | |
| 164 | - 'condition' => [ | |
| 165 | - 'background' => [ 'gradient' ], | |
| 166 | - ], | |
| 167 | - ]; | |
| 168 | - | |
| 169 | 129 | $fields['color'] = [ |
| 170 | - 'label' => esc_html__( 'Color', 'elementor' ), | |
| 130 | + 'label' => _x( 'Color', 'Background Control', 'elementor' ), | |
| 171 | 131 | 'type' => Controls_Manager::COLOR, |
| 172 | 132 | 'default' => '', |
| 173 | - 'control_type' => 'content', | |
| 174 | - 'title' => esc_html__( 'Background Color', 'elementor' ), | |
| 133 | + 'title' => _x( 'Background Color', 'Background Control', 'elementor' ), | |
| 175 | 134 | 'selectors' => [ |
| 176 | 135 | '{{SELECTOR}}' => 'background-color: {{VALUE}};', |
| 177 | 136 | ], |
| 178 | 137 | 'condition' => [ |
| 179 | - 'background' => [ 'classic', 'gradient', 'video' ], | |
| 138 | + 'background' => [ 'classic', 'gradient' ], | |
| 180 | 139 | ], |
| 181 | 140 | ]; |
| 182 | 141 | |
| 183 | 142 | $fields['color_stop'] = [ |
| 184 | - 'label' => esc_html_x( 'Location', 'Background Control', 'elementor' ), | |
| 143 | + 'label' => _x( 'Location', 'Background Control', 'elementor' ), | |
| 185 | 144 | 'type' => Controls_Manager::SLIDER, |
| 186 | - 'size_units' => [ '%', 'custom' ], | |
| 145 | + 'size_units' => [ '%' ], | |
| 187 | 146 | 'default' => [ |
| 188 | 147 | 'unit' => '%', |
| 189 | 148 | 'size' => 0, |
| 190 | 149 | ], |
| 191 | - 'device_args' => $location_device_args, | |
| 192 | - 'responsive' => true, | |
| 193 | 150 | 'render_type' => 'ui', |
| 194 | 151 | 'condition' => [ |
| 195 | 152 | 'background' => [ 'gradient' ], |
| 196 | 153 | ], |
| @@ -197,13 +154,12 @@ | ||
| 197 | 154 | 'of_type' => 'gradient', |
| 198 | 155 | ]; |
| 199 | 156 | |
| 200 | 157 | $fields['color_b'] = [ |
| 201 | - 'label' => esc_html__( 'Second Color', 'elementor' ), | |
| 158 | + 'label' => _x( 'Second Color', 'Background Control', 'elementor' ), | |
| 202 | 159 | 'type' => Controls_Manager::COLOR, |
| 203 | 160 | 'default' => '#f2295b', |
| 204 | 161 | 'render_type' => 'ui', |
| 205 | - 'control_type' => 'content', | |
| 206 | 162 | 'condition' => [ |
| 207 | 163 | 'background' => [ 'gradient' ], |
| 208 | 164 | ], |
| 209 | 165 | 'of_type' => 'gradient', |
| @@ -209,17 +165,15 @@ | ||
| 209 | 165 | 'of_type' => 'gradient', |
| 210 | 166 | ]; |
| 211 | 167 | |
| 212 | 168 | $fields['color_b_stop'] = [ |
| 213 | - 'label' => esc_html_x( 'Location', 'Background Control', 'elementor' ), | |
| 169 | + 'label' => _x( 'Location', 'Background Control', 'elementor' ), | |
| 214 | 170 | 'type' => Controls_Manager::SLIDER, |
| 215 | - 'size_units' => [ '%', 'custom' ], | |
| 171 | + 'size_units' => [ '%' ], | |
| 216 | 172 | 'default' => [ |
| 217 | 173 | 'unit' => '%', |
| 218 | 174 | 'size' => 100, |
| 219 | 175 | ], |
| 220 | - 'device_args' => $location_device_args, | |
| 221 | - 'responsive' => true, | |
| 222 | 176 | 'render_type' => 'ui', |
| 223 | 177 | 'condition' => [ |
| 224 | 178 | 'background' => [ 'gradient' ], |
| 225 | 179 | ], |
| @@ -226,13 +180,13 @@ | ||
| 226 | 180 | 'of_type' => 'gradient', |
| 227 | 181 | ]; |
| 228 | 182 | |
| 229 | 183 | $fields['gradient_type'] = [ |
| 230 | - 'label' => esc_html_x( 'Type', 'Background Control', 'elementor' ), | |
| 184 | + 'label' => _x( 'Type', 'Background Control', 'elementor' ), | |
| 231 | 185 | 'type' => Controls_Manager::SELECT, |
| 232 | 186 | 'options' => [ |
| 233 | - 'linear' => esc_html__( 'Linear', 'elementor' ), | |
| 234 | - 'radial' => esc_html__( 'Radial', 'elementor' ), | |
| 187 | + 'linear' => _x( 'Linear', 'Background Control', 'elementor' ), | |
| 188 | + 'radial' => _x( 'Radial', 'Background Control', 'elementor' ), | |
| 235 | 189 | ], |
| 236 | 190 | 'default' => 'linear', |
| 237 | 191 | 'render_type' => 'ui', |
| 238 | 192 | 'condition' => [ |
| @@ -241,17 +195,20 @@ | ||
| 241 | 195 | 'of_type' => 'gradient', |
| 242 | 196 | ]; |
| 243 | 197 | |
| 244 | 198 | $fields['gradient_angle'] = [ |
| 245 | - 'label' => esc_html__( 'Angle', 'elementor' ), | |
| 199 | + 'label' => _x( 'Angle', 'Background Control', 'elementor' ), | |
| 246 | 200 | 'type' => Controls_Manager::SLIDER, |
| 247 | - 'size_units' => [ 'deg', 'grad', 'rad', 'turn', 'custom' ], | |
| 201 | + 'size_units' => [ 'deg' ], | |
| 248 | 202 | 'default' => [ |
| 249 | 203 | 'unit' => 'deg', |
| 250 | 204 | 'size' => 180, |
| 251 | 205 | ], |
| 252 | - 'device_args' => $angel_device_args, | |
| 253 | - 'responsive' => true, | |
| 206 | + 'range' => [ | |
| 207 | + 'deg' => [ | |
| 208 | + 'step' => 10, | |
| 209 | + ], | |
| 210 | + ], | |
| 254 | 211 | 'selectors' => [ |
| 255 | 212 | '{{SELECTOR}}' => 'background-color: transparent; background-image: linear-gradient({{SIZE}}{{UNIT}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})', |
| 256 | 213 | ], |
| 257 | 214 | 'condition' => [ |
| @@ -261,24 +218,22 @@ | ||
| 261 | 218 | 'of_type' => 'gradient', |
| 262 | 219 | ]; |
| 263 | 220 | |
| 264 | 221 | $fields['gradient_position'] = [ |
| 265 | - 'label' => esc_html__( 'Position', 'elementor' ), | |
| 222 | + 'label' => _x( 'Position', 'Background Control', 'elementor' ), | |
| 266 | 223 | 'type' => Controls_Manager::SELECT, |
| 267 | 224 | 'options' => [ |
| 268 | - 'center center' => esc_html__( 'Center Center', 'elementor' ), | |
| 269 | - 'center left' => esc_html__( 'Center Left', 'elementor' ), | |
| 270 | - 'center right' => esc_html__( 'Center Right', 'elementor' ), | |
| 271 | - 'top center' => esc_html__( 'Top Center', 'elementor' ), | |
| 272 | - 'top left' => esc_html__( 'Top Left', 'elementor' ), | |
| 273 | - 'top right' => esc_html__( 'Top Right', 'elementor' ), | |
| 274 | - 'bottom center' => esc_html__( 'Bottom Center', 'elementor' ), | |
| 275 | - 'bottom left' => esc_html__( 'Bottom Left', 'elementor' ), | |
| 276 | - 'bottom right' => esc_html__( 'Bottom Right', 'elementor' ), | |
| 225 | + 'center center' => _x( 'Center Center', 'Background Control', 'elementor' ), | |
| 226 | + 'center left' => _x( 'Center Left', 'Background Control', 'elementor' ), | |
| 227 | + 'center right' => _x( 'Center Right', 'Background Control', 'elementor' ), | |
| 228 | + 'top center' => _x( 'Top Center', 'Background Control', 'elementor' ), | |
| 229 | + 'top left' => _x( 'Top Left', 'Background Control', 'elementor' ), | |
| 230 | + 'top right' => _x( 'Top Right', 'Background Control', 'elementor' ), | |
| 231 | + 'bottom center' => _x( 'Bottom Center', 'Background Control', 'elementor' ), | |
| 232 | + 'bottom left' => _x( 'Bottom Left', 'Background Control', 'elementor' ), | |
| 233 | + 'bottom right' => _x( 'Bottom Right', 'Background Control', 'elementor' ), | |
| 277 | 234 | ], |
| 278 | 235 | 'default' => 'center center', |
| 279 | - 'device_args' => $position_device_args, | |
| 280 | - 'responsive' => true, | |
| 281 | 236 | 'selectors' => [ |
| 282 | 237 | '{{SELECTOR}}' => 'background-color: transparent; background-image: radial-gradient(at {{VALUE}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})', |
| 283 | 238 | ], |
| 284 | 239 | 'condition' => [ |
| @@ -288,22 +243,18 @@ | ||
| 288 | 243 | 'of_type' => 'gradient', |
| 289 | 244 | ]; |
| 290 | 245 | |
| 291 | 246 | $fields['image'] = [ |
| 292 | - 'label' => esc_html__( 'Image', 'elementor' ), | |
| 247 | + 'label' => _x( 'Image', 'Background Control', 'elementor' ), | |
| 293 | 248 | 'type' => Controls_Manager::MEDIA, |
| 294 | - 'ai' => [ | |
| 295 | - 'category' => 'background', | |
| 296 | - ], | |
| 297 | 249 | 'dynamic' => [ |
| 298 | 250 | 'active' => true, |
| 299 | 251 | ], |
| 300 | 252 | 'responsive' => true, |
| 301 | - 'title' => esc_html__( 'Background Image', 'elementor' ), | |
| 253 | + 'title' => _x( 'Background Image', 'Background Control', 'elementor' ), | |
| 302 | 254 | 'selectors' => [ |
| 303 | 255 | '{{SELECTOR}}' => 'background-image: url("{{URL}}");', |
| 304 | 256 | ], |
| 305 | - 'has_sizes' => true, | |
| 306 | 257 | 'render_type' => 'template', |
| 307 | 258 | 'condition' => [ |
| 308 | 259 | 'background' => [ 'classic' ], |
| 309 | 260 | ], |
| @@ -309,25 +260,24 @@ | ||
| 309 | 260 | ], |
| 310 | 261 | ]; |
| 311 | 262 | |
| 312 | 263 | $fields['position'] = [ |
| 313 | - 'label' => esc_html__( 'Position', 'elementor' ), | |
| 264 | + 'label' => _x( 'Position', 'Background Control', 'elementor' ), | |
| 314 | 265 | 'type' => Controls_Manager::SELECT, |
| 315 | 266 | 'default' => '', |
| 316 | - 'separator' => 'before', | |
| 317 | 267 | 'responsive' => true, |
| 318 | 268 | 'options' => [ |
| 319 | - '' => esc_html__( 'Default', 'elementor' ), | |
| 320 | - 'center center' => esc_html__( 'Center Center', 'elementor' ), | |
| 321 | - 'center left' => esc_html__( 'Center Left', 'elementor' ), | |
| 322 | - 'center right' => esc_html__( 'Center Right', 'elementor' ), | |
| 323 | - 'top center' => esc_html__( 'Top Center', 'elementor' ), | |
| 324 | - 'top left' => esc_html__( 'Top Left', 'elementor' ), | |
| 325 | - 'top right' => esc_html__( 'Top Right', 'elementor' ), | |
| 326 | - 'bottom center' => esc_html__( 'Bottom Center', 'elementor' ), | |
| 327 | - 'bottom left' => esc_html__( 'Bottom Left', 'elementor' ), | |
| 328 | - 'bottom right' => esc_html__( 'Bottom Right', 'elementor' ), | |
| 329 | - 'initial' => esc_html__( 'Custom', 'elementor' ), | |
| 269 | + '' => _x( 'Default', 'Background Control', 'elementor' ), | |
| 270 | + 'center center' => _x( 'Center Center', 'Background Control', 'elementor' ), | |
| 271 | + 'center left' => _x( 'Center Left', 'Background Control', 'elementor' ), | |
| 272 | + 'center right' => _x( 'Center Right', 'Background Control', 'elementor' ), | |
| 273 | + 'top center' => _x( 'Top Center', 'Background Control', 'elementor' ), | |
| 274 | + 'top left' => _x( 'Top Left', 'Background Control', 'elementor' ), | |
| 275 | + 'top right' => _x( 'Top Right', 'Background Control', 'elementor' ), | |
| 276 | + 'bottom center' => _x( 'Bottom Center', 'Background Control', 'elementor' ), | |
| 277 | + 'bottom left' => _x( 'Bottom Left', 'Background Control', 'elementor' ), | |
| 278 | + 'bottom right' => _x( 'Bottom Right', 'Background Control', 'elementor' ), | |
| 279 | + 'initial' => _x( 'Custom', 'Background Control', 'elementor' ), | |
| 330 | 280 | |
| 331 | 281 | ], |
| 332 | 282 | 'selectors' => [ |
| 333 | 283 | '{{SELECTOR}}' => 'background-position: {{VALUE}};', |
| @@ -338,19 +288,22 @@ | ||
| 338 | 288 | ], |
| 339 | 289 | ]; |
| 340 | 290 | |
| 341 | 291 | $fields['xpos'] = [ |
| 342 | - 'label' => esc_html__( 'X Position', 'elementor' ), | |
| 292 | + 'label' => _x( 'X Position', 'Background Control', 'elementor' ), | |
| 343 | 293 | 'type' => Controls_Manager::SLIDER, |
| 344 | 294 | 'responsive' => true, |
| 345 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], | |
| 295 | + 'size_units' => [ 'px', 'em', '%', 'vw' ], | |
| 346 | 296 | 'default' => [ |
| 297 | + 'unit' => 'px', | |
| 347 | 298 | 'size' => 0, |
| 348 | 299 | ], |
| 349 | 300 | 'tablet_default' => [ |
| 301 | + 'unit' => 'px', | |
| 350 | 302 | 'size' => 0, |
| 351 | 303 | ], |
| 352 | 304 | 'mobile_default' => [ |
| 305 | + 'unit' => 'px', | |
| 353 | 306 | 'size' => 0, |
| 354 | 307 | ], |
| 355 | 308 | 'range' => [ |
| 356 | 309 | 'px' => [ |
| @@ -378,22 +331,45 @@ | ||
| 378 | 331 | 'position' => [ 'initial' ], |
| 379 | 332 | 'image[url]!' => '', |
| 380 | 333 | ], |
| 381 | 334 | 'required' => true, |
| 335 | + 'device_args' => [ | |
| 336 | + Controls_Stack::RESPONSIVE_TABLET => [ | |
| 337 | + 'selectors' => [ | |
| 338 | + '{{SELECTOR}}' => 'background-position: {{SIZE}}{{UNIT}} {{ypos_tablet.SIZE}}{{ypos_tablet.UNIT}}', | |
| 339 | + ], | |
| 340 | + 'condition' => [ | |
| 341 | + 'background' => [ 'classic' ], | |
| 342 | + 'position_tablet' => [ 'initial' ], | |
| 343 | + ], | |
| 344 | + ], | |
| 345 | + Controls_Stack::RESPONSIVE_MOBILE => [ | |
| 346 | + 'selectors' => [ | |
| 347 | + '{{SELECTOR}}' => 'background-position: {{SIZE}}{{UNIT}} {{ypos_mobile.SIZE}}{{ypos_mobile.UNIT}}', | |
| 348 | + ], | |
| 349 | + 'condition' => [ | |
| 350 | + 'background' => [ 'classic' ], | |
| 351 | + 'position_mobile' => [ 'initial' ], | |
| 352 | + ], | |
| 353 | + ], | |
| 354 | + ], | |
| 382 | 355 | ]; |
| 383 | 356 | |
| 384 | 357 | $fields['ypos'] = [ |
| 385 | - 'label' => esc_html__( 'Y Position', 'elementor' ), | |
| 358 | + 'label' => _x( 'Y Position', 'Background Control', 'elementor' ), | |
| 386 | 359 | 'type' => Controls_Manager::SLIDER, |
| 387 | 360 | 'responsive' => true, |
| 388 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'custom' ], | |
| 361 | + 'size_units' => [ 'px', 'em', '%', 'vh' ], | |
| 389 | 362 | 'default' => [ |
| 363 | + 'unit' => 'px', | |
| 390 | 364 | 'size' => 0, |
| 391 | 365 | ], |
| 392 | 366 | 'tablet_default' => [ |
| 367 | + 'unit' => 'px', | |
| 393 | 368 | 'size' => 0, |
| 394 | 369 | ], |
| 395 | 370 | 'mobile_default' => [ |
| 371 | + 'unit' => 'px', | |
| 396 | 372 | 'size' => 0, |
| 397 | 373 | ], |
| 398 | 374 | 'range' => [ |
| 399 | 375 | 'px' => [ |
| @@ -421,18 +397,38 @@ | ||
| 421 | 397 | 'position' => [ 'initial' ], |
| 422 | 398 | 'image[url]!' => '', |
| 423 | 399 | ], |
| 424 | 400 | 'required' => true, |
| 401 | + 'device_args' => [ | |
| 402 | + Controls_Stack::RESPONSIVE_TABLET => [ | |
| 403 | + 'selectors' => [ | |
| 404 | + '{{SELECTOR}}' => 'background-position: {{xpos_tablet.SIZE}}{{xpos_tablet.UNIT}} {{SIZE}}{{UNIT}}', | |
| 405 | + ], | |
| 406 | + 'condition' => [ | |
| 407 | + 'background' => [ 'classic' ], | |
| 408 | + 'position_tablet' => [ 'initial' ], | |
| 409 | + ], | |
| 410 | + ], | |
| 411 | + Controls_Stack::RESPONSIVE_MOBILE => [ | |
| 412 | + 'selectors' => [ | |
| 413 | + '{{SELECTOR}}' => 'background-position: {{xpos_mobile.SIZE}}{{xpos_mobile.UNIT}} {{SIZE}}{{UNIT}}', | |
| 414 | + ], | |
| 415 | + 'condition' => [ | |
| 416 | + 'background' => [ 'classic' ], | |
| 417 | + 'position_mobile' => [ 'initial' ], | |
| 418 | + ], | |
| 419 | + ], | |
| 420 | + ], | |
| 425 | 421 | ]; |
| 426 | 422 | |
| 427 | 423 | $fields['attachment'] = [ |
| 428 | - 'label' => esc_html_x( 'Attachment', 'Background Control', 'elementor' ), | |
| 424 | + 'label' => _x( 'Attachment', 'Background Control', 'elementor' ), | |
| 429 | 425 | 'type' => Controls_Manager::SELECT, |
| 430 | 426 | 'default' => '', |
| 431 | 427 | 'options' => [ |
| 432 | - '' => esc_html__( 'Default', 'elementor' ), | |
| 433 | - 'scroll' => esc_html_x( 'Scroll', 'Background Control', 'elementor' ), | |
| 434 | - 'fixed' => esc_html_x( 'Fixed', 'Background Control', 'elementor' ), | |
| 428 | + '' => _x( 'Default', 'Background Control', 'elementor' ), | |
| 429 | + 'scroll' => _x( 'Scroll', 'Background Control', 'elementor' ), | |
| 430 | + 'fixed' => _x( 'Fixed', 'Background Control', 'elementor' ), | |
| 435 | 431 | ], |
| 436 | 432 | 'selectors' => [ |
| 437 | 433 | '(desktop+){{SELECTOR}}' => 'background-attachment: {{VALUE}};', |
| 438 | 434 | ], |
| @@ -444,9 +440,10 @@ | ||
| 444 | 440 | |
| 445 | 441 | $fields['attachment_alert'] = [ |
| 446 | 442 | 'type' => Controls_Manager::RAW_HTML, |
| 447 | 443 | 'content_classes' => 'elementor-control-field-description', |
| 448 | - 'raw' => esc_html__( 'Note: Attachment Fixed works only on desktop.', 'elementor' ), | |
| 444 | + 'raw' => __( 'Note: Attachment Fixed works only on desktop.', 'elementor' ), | |
| 445 | + 'separator' => 'none', | |
| 449 | 446 | 'condition' => [ |
| 450 | 447 | 'background' => [ 'classic' ], |
| 451 | 448 | 'image[url]!' => '', |
| 452 | 449 | 'attachment' => 'fixed', |
| @@ -453,18 +450,18 @@ | ||
| 453 | 450 | ], |
| 454 | 451 | ]; |
| 455 | 452 | |
| 456 | 453 | $fields['repeat'] = [ |
| 457 | - 'label' => esc_html_x( 'Repeat', 'Background Control', 'elementor' ), | |
| 454 | + 'label' => _x( 'Repeat', 'Background Control', 'elementor' ), | |
| 458 | 455 | 'type' => Controls_Manager::SELECT, |
| 459 | 456 | 'default' => '', |
| 460 | 457 | 'responsive' => true, |
| 461 | 458 | 'options' => [ |
| 462 | - '' => esc_html__( 'Default', 'elementor' ), | |
| 463 | - 'no-repeat' => esc_html__( 'No-repeat', 'elementor' ), | |
| 464 | - 'repeat' => esc_html__( 'Repeat', 'elementor' ), | |
| 465 | - 'repeat-x' => esc_html__( 'Repeat-x', 'elementor' ), | |
| 466 | - 'repeat-y' => esc_html__( 'Repeat-y', 'elementor' ), | |
| 459 | + '' => _x( 'Default', 'Background Control', 'elementor' ), | |
| 460 | + 'no-repeat' => _x( 'No-repeat', 'Background Control', 'elementor' ), | |
| 461 | + 'repeat' => _x( 'Repeat', 'Background Control', 'elementor' ), | |
| 462 | + 'repeat-x' => _x( 'Repeat-x', 'Background Control', 'elementor' ), | |
| 463 | + 'repeat-y' => _x( 'Repeat-y', 'Background Control', 'elementor' ), | |
| 467 | 464 | ], |
| 468 | 465 | 'selectors' => [ |
| 469 | 466 | '{{SELECTOR}}' => 'background-repeat: {{VALUE}};', |
| 470 | 467 | ], |
| @@ -474,18 +471,18 @@ | ||
| 474 | 471 | ], |
| 475 | 472 | ]; |
| 476 | 473 | |
| 477 | 474 | $fields['size'] = [ |
| 478 | - 'label' => esc_html__( 'Display Size', 'elementor' ), | |
| 475 | + 'label' => _x( 'Size', 'Background Control', 'elementor' ), | |
| 479 | 476 | 'type' => Controls_Manager::SELECT, |
| 480 | 477 | 'responsive' => true, |
| 481 | 478 | 'default' => '', |
| 482 | 479 | 'options' => [ |
| 483 | - '' => esc_html__( 'Default', 'elementor' ), | |
| 484 | - 'auto' => esc_html__( 'Auto', 'elementor' ), | |
| 485 | - 'cover' => esc_html__( 'Cover', 'elementor' ), | |
| 486 | - 'contain' => esc_html__( 'Contain', 'elementor' ), | |
| 487 | - 'initial' => esc_html__( 'Custom', 'elementor' ), | |
| 480 | + '' => _x( 'Default', 'Background Control', 'elementor' ), | |
| 481 | + 'auto' => _x( 'Auto', 'Background Control', 'elementor' ), | |
| 482 | + 'cover' => _x( 'Cover', 'Background Control', 'elementor' ), | |
| 483 | + 'contain' => _x( 'Contain', 'Background Control', 'elementor' ), | |
| 484 | + 'initial' => _x( 'Custom', 'Background Control', 'elementor' ), | |
| 488 | 485 | ], |
| 489 | 486 | 'selectors' => [ |
| 490 | 487 | '{{SELECTOR}}' => 'background-size: {{VALUE}};', |
| 491 | 488 | ], |
| @@ -495,16 +492,25 @@ | ||
| 495 | 492 | ], |
| 496 | 493 | ]; |
| 497 | 494 | |
| 498 | 495 | $fields['bg_width'] = [ |
| 499 | - 'label' => esc_html__( 'Width', 'elementor' ), | |
| 496 | + 'label' => _x( 'Width', 'Background Control', 'elementor' ), | |
| 500 | 497 | 'type' => Controls_Manager::SLIDER, |
| 501 | 498 | 'responsive' => true, |
| 502 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], | |
| 499 | + 'size_units' => [ 'px', 'em', '%', 'vw' ], | |
| 503 | 500 | 'range' => [ |
| 504 | 501 | 'px' => [ |
| 502 | + 'min' => 0, | |
| 505 | 503 | 'max' => 1000, |
| 506 | 504 | ], |
| 505 | + '%' => [ | |
| 506 | + 'min' => 0, | |
| 507 | + 'max' => 100, | |
| 508 | + ], | |
| 509 | + 'vw' => [ | |
| 510 | + 'min' => 0, | |
| 511 | + 'max' => 100, | |
| 512 | + ], | |
| 507 | 513 | ], |
| 508 | 514 | 'default' => [ |
| 509 | 515 | 'size' => 100, |
| 510 | 516 | 'unit' => '%', |
| @@ -518,27 +524,37 @@ | ||
| 518 | 524 | 'background' => [ 'classic' ], |
| 519 | 525 | 'size' => [ 'initial' ], |
| 520 | 526 | 'image[url]!' => '', |
| 521 | 527 | ], |
| 528 | + 'device_args' => [ | |
| 529 | + Controls_Stack::RESPONSIVE_TABLET => [ | |
| 530 | + 'selectors' => [ | |
| 531 | + '{{SELECTOR}}' => 'background-size: {{SIZE}}{{UNIT}} auto', | |
| 532 | + ], | |
| 533 | + 'condition' => [ | |
| 534 | + 'background' => [ 'classic' ], | |
| 535 | + 'size_tablet' => [ 'initial' ], | |
| 536 | + ], | |
| 537 | + ], | |
| 538 | + Controls_Stack::RESPONSIVE_MOBILE => [ | |
| 539 | + 'selectors' => [ | |
| 540 | + '{{SELECTOR}}' => 'background-size: {{SIZE}}{{UNIT}} auto', | |
| 541 | + ], | |
| 542 | + 'condition' => [ | |
| 543 | + 'background' => [ 'classic' ], | |
| 544 | + 'size_mobile' => [ 'initial' ], | |
| 545 | + ], | |
| 546 | + ], | |
| 547 | + ], | |
| 522 | 548 | ]; |
| 523 | 549 | |
| 524 | 550 | $fields['video_link'] = [ |
| 525 | - 'label' => esc_html__( 'Video Link', 'elementor' ), | |
| 551 | + 'label' => _x( 'Video Link', 'Background Control', 'elementor' ), | |
| 526 | 552 | 'type' => Controls_Manager::TEXT, |
| 527 | 553 | 'placeholder' => 'https://www.youtube.com/watch?v=XHOmBV4js_E', |
| 528 | - 'description' => esc_html__( 'YouTube/Vimeo link, or link to video file (mp4 is recommended).', 'elementor' ), | |
| 554 | + 'description' => __( 'YouTube/Vimeo link, or link to video file (mp4 is recommended).', 'elementor' ), | |
| 529 | 555 | 'label_block' => true, |
| 530 | 556 | 'default' => '', |
| 531 | - 'dynamic' => [ | |
| 532 | - 'active' => true, | |
| 533 | - 'categories' => [ | |
| 534 | - TagsModule::POST_META_CATEGORY, | |
| 535 | - TagsModule::URL_CATEGORY, | |
| 536 | - ], | |
| 537 | - ], | |
| 538 | - 'ai' => [ | |
| 539 | - 'active' => false, | |
| 540 | - ], | |
| 541 | 557 | 'condition' => [ |
| 542 | 558 | 'background' => [ 'video' ], |
| 543 | 559 | ], |
| 544 | 560 | 'of_type' => 'video', |
| @@ -545,11 +561,11 @@ | ||
| 545 | 561 | 'frontend_available' => true, |
| 546 | 562 | ]; |
| 547 | 563 | |
| 548 | 564 | $fields['video_start'] = [ |
| 549 | - 'label' => esc_html__( 'Start Time', 'elementor' ), | |
| 565 | + 'label' => __( 'Start Time', 'elementor' ), | |
| 550 | 566 | 'type' => Controls_Manager::NUMBER, |
| 551 | - 'description' => esc_html__( 'Specify a start time (in seconds)', 'elementor' ), | |
| 567 | + 'description' => __( 'Specify a start time (in seconds)', 'elementor' ), | |
| 552 | 568 | 'placeholder' => 10, |
| 553 | 569 | 'condition' => [ |
| 554 | 570 | 'background' => [ 'video' ], |
| 555 | 571 | ], |
| @@ -557,11 +573,11 @@ | ||
| 557 | 573 | 'frontend_available' => true, |
| 558 | 574 | ]; |
| 559 | 575 | |
| 560 | 576 | $fields['video_end'] = [ |
| 561 | - 'label' => esc_html__( 'End Time', 'elementor' ), | |
| 577 | + 'label' => __( 'End Time', 'elementor' ), | |
| 562 | 578 | 'type' => Controls_Manager::NUMBER, |
| 563 | - 'description' => esc_html__( 'Specify an end time (in seconds)', 'elementor' ), | |
| 579 | + 'description' => __( 'Specify an end time (in seconds)', 'elementor' ), | |
| 564 | 580 | 'placeholder' => 70, |
| 565 | 581 | 'condition' => [ |
| 566 | 582 | 'background' => [ 'video' ], |
| 567 | 583 | ], |
| @@ -569,9 +585,9 @@ | ||
| 569 | 585 | 'frontend_available' => true, |
| 570 | 586 | ]; |
| 571 | 587 | |
| 572 | 588 | $fields['play_once'] = [ |
| 573 | - 'label' => esc_html__( 'Play Once', 'elementor' ), | |
| 589 | + 'label' => __( 'Play Once', 'elementor' ), | |
| 574 | 590 | 'type' => Controls_Manager::SWITCHER, |
| 575 | 591 | 'condition' => [ |
| 576 | 592 | 'background' => [ 'video' ], |
| 577 | 593 | ], |
| @@ -579,9 +595,9 @@ | ||
| 579 | 595 | 'frontend_available' => true, |
| 580 | 596 | ]; |
| 581 | 597 | |
| 582 | 598 | $fields['play_on_mobile'] = [ |
| 583 | - 'label' => esc_html__( 'Play On Mobile', 'elementor' ), | |
| 599 | + 'label' => __( 'Play On Mobile', 'elementor' ), | |
| 584 | 600 | 'type' => Controls_Manager::SWITCHER, |
| 585 | 601 | 'condition' => [ |
| 586 | 602 | 'background' => [ 'video' ], |
| 587 | 603 | ], |
| @@ -588,29 +604,12 @@ | ||
| 588 | 604 | 'of_type' => 'video', |
| 589 | 605 | 'frontend_available' => true, |
| 590 | 606 | ]; |
| 591 | 607 | |
| 592 | - // This control was added to handle a bug with the Youtube Embed API. The bug: If there is a video with Privacy | |
| 593 | - // Mode on, and at the same time the page contains another video WITHOUT privacy mode on, one of the videos | |
| 594 | - // will not run properly. This added control allows users to align all their videos to one host (either | |
| 595 | - // youtube.com or youtube-nocookie.com, depending on whether the user wants privacy mode on or not). | |
| 596 | - $fields['privacy_mode'] = [ | |
| 597 | - 'label' => esc_html__( 'Privacy Mode', 'elementor' ), | |
| 598 | - 'type' => Controls_Manager::SWITCHER, | |
| 599 | - 'condition' => [ | |
| 600 | - 'background' => [ 'video' ], | |
| 601 | - ], | |
| 602 | - 'of_type' => 'video', | |
| 603 | - 'frontend_available' => true, | |
| 604 | - ]; | |
| 605 | - | |
| 606 | 608 | $fields['video_fallback'] = [ |
| 607 | - 'label' => esc_html__( 'Background Fallback', 'elementor' ), | |
| 608 | - 'description' => esc_html__( 'This cover image will replace the background video in case that the video could not be loaded.', 'elementor' ), | |
| 609 | + 'label' => _x( 'Background Fallback', 'Background Control', 'elementor' ), | |
| 610 | + 'description' => __( 'This cover image will replace the background video in case that the video could not be loaded.', 'elementor' ), | |
| 609 | 611 | 'type' => Controls_Manager::MEDIA, |
| 610 | - 'dynamic' => [ | |
| 611 | - 'active' => true, | |
| 612 | - ], | |
| 613 | 612 | 'condition' => [ |
| 614 | 613 | 'background' => [ 'video' ], |
| 615 | 614 | ], |
| 616 | 615 | 'selectors' => [ |
| @@ -619,9 +618,9 @@ | ||
| 619 | 618 | 'of_type' => 'video', |
| 620 | 619 | ]; |
| 621 | 620 | |
| 622 | 621 | $fields['slideshow_gallery'] = [ |
| 623 | - 'label' => esc_html__( 'Images', 'elementor' ), | |
| 622 | + 'label' => _x( 'Images', 'Background Control', 'elementor' ), | |
| 624 | 623 | 'type' => Controls_Manager::GALLERY, |
| 625 | 624 | 'condition' => [ |
| 626 | 625 | 'background' => [ 'slideshow' ], |
| 627 | 626 | ], |
| @@ -630,9 +629,9 @@ | ||
| 630 | 629 | 'frontend_available' => true, |
| 631 | 630 | ]; |
| 632 | 631 | |
| 633 | 632 | $fields['slideshow_loop'] = [ |
| 634 | - 'label' => esc_html__( 'Infinite Loop', 'elementor' ), | |
| 633 | + 'label' => __( 'Infinite Loop', 'elementor' ), | |
| 635 | 634 | 'type' => Controls_Manager::SWITCHER, |
| 636 | 635 | 'default' => 'yes', |
| 637 | 636 | 'condition' => [ |
| 638 | 637 | 'background' => [ 'slideshow' ], |
| @@ -641,9 +640,9 @@ | ||
| 641 | 640 | 'frontend_available' => true, |
| 642 | 641 | ]; |
| 643 | 642 | |
| 644 | 643 | $fields['slideshow_slide_duration'] = [ |
| 645 | - 'label' => esc_html__( 'Duration', 'elementor' ) . ' (ms)', | |
| 644 | + 'label' => __( 'Duration', 'elementor' ) . ' (ms)', | |
| 646 | 645 | 'type' => Controls_Manager::NUMBER, |
| 647 | 646 | 'default' => 5000, |
| 648 | 647 | 'condition' => [ |
| 649 | 648 | 'background' => [ 'slideshow' ], |
| @@ -651,9 +650,9 @@ | ||
| 651 | 650 | 'frontend_available' => true, |
| 652 | 651 | ]; |
| 653 | 652 | |
| 654 | 653 | $fields['slideshow_slide_transition'] = [ |
| 655 | - 'label' => esc_html__( 'Transition', 'elementor' ), | |
| 654 | + 'label' => __( 'Transition', 'elementor' ), | |
| 656 | 655 | 'type' => Controls_Manager::SELECT, |
| 657 | 656 | 'default' => 'fade', |
| 658 | 657 | 'options' => [ |
| 659 | 658 | 'fade' => 'Fade', |
| @@ -669,9 +668,9 @@ | ||
| 669 | 668 | 'frontend_available' => true, |
| 670 | 669 | ]; |
| 671 | 670 | |
| 672 | 671 | $fields['slideshow_transition_duration'] = [ |
| 673 | - 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (ms)', | |
| 672 | + 'label' => __( 'Transition Duration', 'elementor' ) . ' (ms)', | |
| 674 | 673 | 'type' => Controls_Manager::NUMBER, |
| 675 | 674 | 'default' => 500, |
| 676 | 675 | 'condition' => [ |
| 677 | 676 | 'background' => [ 'slideshow' ], |
| @@ -679,17 +678,17 @@ | ||
| 679 | 678 | 'frontend_available' => true, |
| 680 | 679 | ]; |
| 681 | 680 | |
| 682 | 681 | $fields['slideshow_background_size'] = [ |
| 683 | - 'label' => esc_html__( 'Background Size', 'elementor' ), | |
| 682 | + 'label' => __( 'Background Size', 'elementor' ), | |
| 684 | 683 | 'type' => Controls_Manager::SELECT, |
| 685 | 684 | 'responsive' => true, |
| 686 | 685 | 'default' => '', |
| 687 | 686 | 'options' => [ |
| 688 | - '' => esc_html__( 'Default', 'elementor' ), | |
| 689 | - 'auto' => esc_html__( 'Auto', 'elementor' ), | |
| 690 | - 'cover' => esc_html__( 'Cover', 'elementor' ), | |
| 691 | - 'contain' => esc_html__( 'Contain', 'elementor' ), | |
| 687 | + '' => __( 'Default', 'elementor' ), | |
| 688 | + 'auto' => __( 'Auto', 'elementor' ), | |
| 689 | + 'cover' => __( 'Cover', 'elementor' ), | |
| 690 | + 'contain' => __( 'Contain', 'elementor' ), | |
| 692 | 691 | ], |
| 693 | 692 | 'selectors' => [ |
| 694 | 693 | '{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-size: {{VALUE}};', |
| 695 | 694 | ], |
| @@ -698,23 +697,23 @@ | ||
| 698 | 697 | ], |
| 699 | 698 | ]; |
| 700 | 699 | |
| 701 | 700 | $fields['slideshow_background_position'] = [ |
| 702 | - 'label' => esc_html__( 'Background Position', 'elementor' ), | |
| 701 | + 'label' => __( 'Background Position', 'elementor' ), | |
| 703 | 702 | 'type' => Controls_Manager::SELECT, |
| 704 | 703 | 'default' => '', |
| 705 | 704 | 'responsive' => true, |
| 706 | 705 | 'options' => [ |
| 707 | - '' => esc_html__( 'Default', 'elementor' ), | |
| 708 | - 'center center' => esc_html__( 'Center Center', 'elementor' ), | |
| 709 | - 'center left' => esc_html__( 'Center Left', 'elementor' ), | |
| 710 | - 'center right' => esc_html__( 'Center Right', 'elementor' ), | |
| 711 | - 'top center' => esc_html__( 'Top Center', 'elementor' ), | |
| 712 | - 'top left' => esc_html__( 'Top Left', 'elementor' ), | |
| 713 | - 'top right' => esc_html__( 'Top Right', 'elementor' ), | |
| 714 | - 'bottom center' => esc_html__( 'Bottom Center', 'elementor' ), | |
| 715 | - 'bottom left' => esc_html__( 'Bottom Left', 'elementor' ), | |
| 716 | - 'bottom right' => esc_html__( 'Bottom Right', 'elementor' ), | |
| 706 | + '' => __( 'Default', 'elementor' ), | |
| 707 | + 'center center' => _x( 'Center Center', 'Background Control', 'elementor' ), | |
| 708 | + 'center left' => _x( 'Center Left', 'Background Control', 'elementor' ), | |
| 709 | + 'center right' => _x( 'Center Right', 'Background Control', 'elementor' ), | |
| 710 | + 'top center' => _x( 'Top Center', 'Background Control', 'elementor' ), | |
| 711 | + 'top left' => _x( 'Top Left', 'Background Control', 'elementor' ), | |
| 712 | + 'top right' => _x( 'Top Right', 'Background Control', 'elementor' ), | |
| 713 | + 'bottom center' => _x( 'Bottom Center', 'Background Control', 'elementor' ), | |
| 714 | + 'bottom left' => _x( 'Bottom Left', 'Background Control', 'elementor' ), | |
| 715 | + 'bottom right' => _x( 'Bottom Right', 'Background Control', 'elementor' ), | |
| 717 | 716 | ], |
| 718 | 717 | 'selectors' => [ |
| 719 | 718 | '{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-position: {{VALUE}};', |
| 720 | 719 | ], |
| @@ -722,21 +721,10 @@ | ||
| 722 | 721 | 'background' => [ 'slideshow' ], |
| 723 | 722 | ], |
| 724 | 723 | ]; |
| 725 | 724 | |
| 726 | - $fields['slideshow_lazyload'] = [ | |
| 727 | - 'label' => esc_html__( 'Lazyload', 'elementor' ), | |
| 728 | - 'type' => Controls_Manager::SWITCHER, | |
| 729 | - 'separator' => 'before', | |
| 730 | - 'condition' => [ | |
| 731 | - 'background' => [ 'slideshow' ], | |
| 732 | - ], | |
| 733 | - 'of_type' => 'slideshow', | |
| 734 | - 'frontend_available' => true, | |
| 735 | - ]; | |
| 736 | - | |
| 737 | 725 | $fields['slideshow_ken_burns'] = [ |
| 738 | - 'label' => esc_html__( 'Ken Burns Effect', 'elementor' ), | |
| 726 | + 'label' => __( 'Ken Burns Effect', 'elementor' ), | |
| 739 | 727 | 'type' => Controls_Manager::SWITCHER, |
| 740 | 728 | 'separator' => 'before', |
| 741 | 729 | 'condition' => [ |
| 742 | 730 | 'background' => [ 'slideshow' ], |
| @@ -745,14 +733,14 @@ | ||
| 745 | 733 | 'frontend_available' => true, |
| 746 | 734 | ]; |
| 747 | 735 | |
| 748 | 736 | $fields['slideshow_ken_burns_zoom_direction'] = [ |
| 749 | - 'label' => esc_html__( 'Direction', 'elementor' ), | |
| 737 | + 'label' => __( 'Direction', 'elementor' ), | |
| 750 | 738 | 'type' => Controls_Manager::SELECT, |
| 751 | 739 | 'default' => 'in', |
| 752 | 740 | 'options' => [ |
| 753 | - 'in' => esc_html__( 'In', 'elementor' ), | |
| 754 | - 'out' => esc_html__( 'Out', 'elementor' ), | |
| 741 | + 'in' => __( 'In', 'elementor' ), | |
| 742 | + 'out' => __( 'Out', 'elementor' ), | |
| 755 | 743 | ], |
| 756 | 744 | 'condition' => [ |
| 757 | 745 | 'background' => [ 'slideshow' ], |
| 758 | 746 | 'slideshow_ken_burns!' => '', |