| @@ -123,15 +123,15 @@ | ||
| 123 | 123 | return ELEMENTOR_ASSETS_URL . 'mask-shapes/' . $shape . '.svg'; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | - * Get a list of the available mask shapes. | |
| 127 | + * Return a translated user-friendly list of the available masking shapes. | |
| 128 | 128 | * |
| 129 | - * @param bool $custom_button Determine if the output should contain `Custom Mask` button. | |
| 129 | + * @param bool $add_custom Determine if the output should contain `Custom` options. | |
| 130 | 130 | * |
| 131 | - * @return array A list of mask shapes. | |
| 131 | + * @return array Array of shapes with their URL as key. | |
| 132 | 132 | */ |
| 133 | - private function get_shapes( $custom_button = true ): array { | |
| 133 | + private function get_shapes( $add_custom = true ) { | |
| 134 | 134 | $shapes = [ |
| 135 | 135 | 'circle' => [ |
| 136 | 136 | 'title' => esc_html__( 'Circle', 'elementor' ), |
| 137 | 137 | 'image' => ELEMENTOR_ASSETS_URL . 'mask-shapes/circle.svg', |
| @@ -213,11 +213,9 @@ | ||
| 213 | 213 | 'image' => ELEMENTOR_ASSETS_URL . 'mask-shapes/blob.svg', |
| 214 | 214 | ], |
| 215 | 215 | ]; |
| 216 | 216 | |
| 217 | - $shapes = array_merge( $shapes, self::get_additional_mask_shapes() ); | |
| 218 | - | |
| 219 | - if ( $custom_button ) { | |
| 217 | + if ( $add_custom ) { | |
| 220 | 218 | $shapes['custom'] = [ |
| 221 | 219 | 'type' => 'button', |
| 222 | 220 | 'title' => esc_html__( 'Custom Mask', 'elementor' ), |
| 223 | 221 | ]; |
| @@ -226,40 +224,8 @@ | ||
| 226 | 224 | return $shapes; |
| 227 | 225 | } |
| 228 | 226 | |
| 229 | 227 | /** |
| 230 | - * Get additional mask shapes. | |
| 231 | - * | |
| 232 | - * Used to add custom mask shapes to elementor. | |
| 233 | - * | |
| 234 | - * @since 3.30.0 | |
| 235 | - * | |
| 236 | - * @return array A list of additional mask shapes. | |
| 237 | - */ | |
| 238 | - private static function get_additional_mask_shapes(): array { | |
| 239 | - static $additional_mask_shapes = null; | |
| 240 | - | |
| 241 | - if ( null !== $additional_mask_shapes ) { | |
| 242 | - return $additional_mask_shapes; | |
| 243 | - } | |
| 244 | - | |
| 245 | - $additional_mask_shapes = []; | |
| 246 | - | |
| 247 | - /** | |
| 248 | - * Additional mask shapes. | |
| 249 | - * | |
| 250 | - * Filters the mask shapes used by Elementor to add additional mask shapes. | |
| 251 | - * | |
| 252 | - * @since 3.30.0 | |
| 253 | - * | |
| 254 | - * @param array $additional_mask_shapes Additional mask shapes. | |
| 255 | - */ | |
| 256 | - $additional_mask_shapes = apply_filters( 'elementor/mask_shapes/additional_shapes', $additional_mask_shapes ); | |
| 257 | - | |
| 258 | - return $additional_mask_shapes; | |
| 259 | - } | |
| 260 | - | |
| 261 | - /** | |
| 262 | 228 | * Gets a string of CSS rules to apply, and returns an array of selectors with those rules. |
| 263 | 229 | * This function has been created in order to deal with masking for image widget. |
| 264 | 230 | * For most of the widgets the mask is being applied to the wrapper itself, but in the case of an image widget, |
| 265 | 231 | * the `img` tag should be masked directly. So instead of writing a lot of selectors every time, |
| @@ -275,9 +241,10 @@ | ||
| 275 | 241 | 'image' => static::MASK_SELECTOR_IMG, |
| 276 | 242 | ]; |
| 277 | 243 | |
| 278 | 244 | return [ |
| 279 | - $mask_selectors['default'] . ', ' . $mask_selectors['image'] => $rules, | |
| 245 | + $mask_selectors['default'] => $rules, | |
| 246 | + $mask_selectors['image'] => $rules, | |
| 280 | 247 | ]; |
| 281 | 248 | } |
| 282 | 249 | |
| 283 | 250 | /** |
| @@ -388,9 +355,9 @@ | ||
| 388 | 355 | [ |
| 389 | 356 | 'label' => esc_html__( 'Column Span', 'elementor' ), |
| 390 | 357 | 'type' => Controls_Manager::SELECT, |
| 391 | 358 | 'options' => [ |
| 392 | - '' => ' ' . esc_html__( 'Default', 'elementor' ), | |
| 359 | + '' => ' Default', | |
| 393 | 360 | '1' => '1', |
| 394 | 361 | '2' => '2', |
| 395 | 362 | '3' => '3', |
| 396 | 363 | '4' => '4', |
| @@ -401,9 +368,9 @@ | ||
| 401 | 368 | '9' => '9', |
| 402 | 369 | '10' => '10', |
| 403 | 370 | '11' => '11', |
| 404 | 371 | '12' => '12', |
| 405 | - 'custom' => esc_html__( 'Custom', 'elementor' ), | |
| 372 | + 'custom' => 'Custom', | |
| 406 | 373 | ], |
| 407 | 374 | 'selectors' => [ |
| 408 | 375 | '{{WRAPPER}}' => 'grid-column: span {{VALUE}};', |
| 409 | 376 | ], |
| @@ -432,9 +399,9 @@ | ||
| 432 | 399 | [ |
| 433 | 400 | 'label' => esc_html__( 'Row Span', 'elementor' ), |
| 434 | 401 | 'type' => Controls_Manager::SELECT, |
| 435 | 402 | 'options' => [ |
| 436 | - '' => ' ' . esc_html__( 'Default', 'elementor' ), | |
| 403 | + '' => ' Default', | |
| 437 | 404 | '1' => '1', |
| 438 | 405 | '2' => '2', |
| 439 | 406 | '3' => '3', |
| 440 | 407 | '4' => '4', |
| @@ -445,9 +412,9 @@ | ||
| 445 | 412 | '9' => '9', |
| 446 | 413 | '10' => '10', |
| 447 | 414 | '11' => '11', |
| 448 | 415 | '12' => '12', |
| 449 | - 'custom' => esc_html__( 'Custom', 'elementor' ), | |
| 416 | + 'custom' => 'Custom', | |
| 450 | 417 | ], |
| 451 | 418 | 'selectors' => [ |
| 452 | 419 | '{{WRAPPER}}' => 'grid-row: span {{VALUE}};', |
| 453 | 420 | ], |
| @@ -1109,9 +1076,9 @@ | ||
| 1109 | 1076 | ], |
| 1110 | 1077 | ] |
| 1111 | 1078 | ); |
| 1112 | 1079 | |
| 1113 | - $this->add_responsive_control( | |
| 1080 | + $this->add_control( | |
| 1114 | 1081 | '_mask_image', |
| 1115 | 1082 | [ |
| 1116 | 1083 | 'label' => esc_html__( 'Image', 'elementor' ), |
| 1117 | 1084 | 'type' => Controls_Manager::MEDIA, |
| @@ -1124,8 +1091,26 @@ | ||
| 1124 | 1091 | 'selectors' => $this->get_mask_selectors( '-webkit-mask-image: url( {{URL}} );' ), |
| 1125 | 1092 | 'condition' => [ |
| 1126 | 1093 | '_mask_switch!' => '', |
| 1127 | 1094 | '_mask_shape' => 'custom', |
| 1095 | + ], | |
| 1096 | + ] | |
| 1097 | + ); | |
| 1098 | + | |
| 1099 | + $this->add_control( | |
| 1100 | + '_mask_notice', | |
| 1101 | + [ | |
| 1102 | + 'type' => Controls_Manager::HIDDEN, | |
| 1103 | + 'raw' => esc_html__( 'Need More Shapes?', 'elementor' ) . | |
| 1104 | + '<br>' . | |
| 1105 | + sprintf( | |
| 1106 | + '%1$s <a target="_blank" href="https://go.elementor.com/mask-control">%2$s</a>', | |
| 1107 | + esc_html__( 'Explore additional Premium Shape packs and use them in your site.', 'elementor' ), | |
| 1108 | + esc_html__( 'Learn more', 'elementor' ), | |
| 1109 | + ), | |
| 1110 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', | |
| 1111 | + 'condition' => [ | |
| 1112 | + '_mask_switch!' => '', | |
| 1128 | 1113 | ], |
| 1129 | 1114 | ] |
| 1130 | 1115 | ); |
| 1131 | 1116 | |