PluginProbe
Elementor Website Builder – more than just a page builder / 3.4.8
Elementor Website Builder – more than just a page builder v3.4.8
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/managers/controls.php +26 -404 4.0.73.4.8 View file →
@@ -1,9 +1,7 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 -use Elementor\Core\Frontend\Performance;
5 -
6 4 if ( ! defined( 'ABSPATH' ) ) {
7 5 exit; // Exit if accessed directly.
8 6 }
9 7
@@ -93,23 +91,13 @@
93 91 */
94 92 const RAW_HTML = 'raw_html';
95 93
96 94 /**
97 - * Notice control.
98 - */
99 - const NOTICE = 'notice';
100 -
101 - /**
102 95 * Deprecated Notice control.
103 96 */
104 97 const DEPRECATED_NOTICE = 'deprecated_notice';
105 98
106 99 /**
107 - * Alert control.
108 - */
109 - const ALERT = 'alert';
110 -
111 - /**
112 100 * Popover Toggle control.
113 101 */
114 102 const POPOVER_TOGGLE = 'popover_toggle';
115 103
@@ -158,13 +146,8 @@
158 146 */
159 147 const CHOOSE = 'choose';
160 148
161 149 /**
162 - * Visual_Choice control.
163 - */
164 - const VISUAL_CHOICE = 'visual_choice';
165 -
166 - /**
167 150 * WYSIWYG control.
168 151 */
169 152 const WYSIWYG = 'wysiwyg';
170 153
@@ -253,13 +236,8 @@
253 236 */
254 237 const EXIT_ANIMATION = 'exit_animation';
255 238
256 239 /**
257 - * Gaps control.
258 - */
259 - const GAPS = 'gaps';
260 -
261 - /**
262 240 * Controls.
263 241 *
264 242 * Holds the list of all the controls. Default is `null`.
265 243 *
@@ -307,21 +285,8 @@
307 285 */
308 286 private static $tabs;
309 287
310 288 /**
311 - * Has stacks cache been cleared.
312 - *
313 - * Boolean flag used to determine whether the controls manager stack cache has been cleared once during the current runtime.
314 - *
315 - * @since 3.13.0
316 - * @access private
317 - * @static
318 - *
319 - * @var array
320 - */
321 - private $has_stacks_cache_been_cleared = false;
322 -
323 - /**
324 289 * Init tabs.
325 290 *
326 291 * Initialize control tabs.
327 292 *
@@ -392,12 +357,8 @@
392 357 'image-size',
393 358 'box-shadow',
394 359 'css-filter',
395 360 'text-shadow',
396 - 'flex-container',
397 - 'grid-container',
398 - 'flex-item',
399 - 'text-stroke',
400 361 ];
401 362 }
402 363
403 364 public static function get_controls_names() {
@@ -417,10 +378,8 @@
417 378 self::TAB,
418 379 self::TABS,
419 380 self::DIVIDER,
420 381 self::DEPRECATED_NOTICE,
421 - self::ALERT,
422 - self::NOTICE,
423 382
424 383 self::COLOR,
425 384 self::MEDIA,
426 385 self::SLIDER,
@@ -425,14 +384,12 @@
425 384 self::MEDIA,
426 385 self::SLIDER,
427 386 self::DIMENSIONS,
428 387 self::CHOOSE,
429 - self::VISUAL_CHOICE,
430 388 self::WYSIWYG,
431 389 self::CODE,
432 390 self::FONT,
433 391 self::IMAGE_DIMENSIONS,
434 - self::GAPS,
435 392
436 393 self::WP_WIDGET,
437 394
438 395 self::URL,
@@ -472,9 +429,9 @@
472 429 foreach ( self::get_controls_names() as $control_id ) {
473 430 $control_class_id = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $control_id ) ) );
474 431 $class_name = __NAMESPACE__ . '\Control_' . $control_class_id;
475 432
476 - $this->register( new $class_name() );
433 + $this->register_control( $control_id, new $class_name() );
477 434 }
478 435
479 436 // Group Controls
480 437 foreach ( self::get_groups_names() as $group_name ) {
@@ -489,32 +446,12 @@
489 446 *
490 447 * Fires after Elementor controls are registered.
491 448 *
492 449 * @since 1.0.0
493 - * @deprecated 3.5.0 Use `elementor/controls/register` hook instead.
494 450 *
495 451 * @param Controls_Manager $this The controls manager.
496 452 */
497 - // TODO: Uncomment when Pro uses the new hook.
498 - // Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->do_deprecated_action(
499 - // 'elementor/controls/controls_registered',
500 - // [ $this ],
501 - // '3.5.0',
502 - // 'elementor/controls/register'
503 - // );
504 -
505 453 do_action( 'elementor/controls/controls_registered', $this );
506 -
507 - /**
508 - * After controls registered.
509 - *
510 - * Fires after Elementor controls are registered.
511 - *
512 - * @since 3.5.0
513 - *
514 - * @param Controls_Manager $this The controls manager.
515 - */
516 - do_action( 'elementor/controls/register', $this );
517 454 }
518 455
519 456 /**
520 457 * Register control.
@@ -523,9 +460,8 @@
523 460 * control to any given control instance.
524 461 *
525 462 * @since 1.0.0
526 463 * @access public
527 - * @deprecated 3.5.0 Use `register()` method instead.
528 464 *
529 465 * @param string $control_id Control ID.
530 466 * @param Base_Control $control_instance Control instance, usually the
531 467 * current instance.
@@ -530,43 +466,8 @@
530 466 * @param Base_Control $control_instance Control instance, usually the
531 467 * current instance.
532 468 */
533 469 public function register_control( $control_id, Base_Control $control_instance ) {
534 - // TODO: Uncomment when Pro uses the new hook.
535 - // Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function(
536 - // __METHOD__,
537 - // '3.5.0',
538 - // 'register()'
539 - // );
540 -
541 - $this->register( $control_instance, $control_id );
542 - }
543 -
544 - /**
545 - * Register control.
546 - *
547 - * This method adds a new control to the controls list. It adds any given
548 - * control to any given control instance.
549 - *
550 - * @since 3.5.0
551 - * @access public
552 - *
553 - * @param Base_Control $control_instance Control instance, usually the current instance.
554 - * @param string $control_id Control ID. Deprecated parameter.
555 - *
556 - * @return void
557 - */
558 - public function register( Base_Control $control_instance, $control_id = null ) {
559 -
560 - // TODO: For BC. Remove in the future.
561 - if ( $control_id ) {
562 - Plugin::instance()->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_argument(
563 - '$control_id', '3.5.0'
564 - );
565 - } else {
566 - $control_id = $control_instance->get_type();
567 - }
568 -
569 470 $this->controls[ $control_id ] = $control_instance;
570 471 }
571 472
572 473 /**
@@ -575,9 +476,8 @@
575 476 * This method removes control from the controls list.
576 477 *
577 478 * @since 1.0.0
578 479 * @access public
579 - * @deprecated 3.5.0 Use `unregister()` method instead.
580 480 *
581 481 * @param string $control_id Control ID.
582 482 *
583 483 * @return bool True if the control was removed, False otherwise.
@@ -582,30 +482,8 @@
582 482 *
583 483 * @return bool True if the control was removed, False otherwise.
584 484 */
585 485 public function unregister_control( $control_id ) {
586 - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function(
587 - __METHOD__,
588 - '3.5.0',
589 - 'unregister()'
590 - );
591 -
592 - return $this->unregister( $control_id );
593 - }
594 -
595 - /**
596 - * Unregister control.
597 - *
598 - * This method removes control from the controls list.
599 - *
600 - * @since 3.5.0
601 - * @access public
602 - *
603 - * @param string $control_id Control ID.
604 - *
605 - * @return bool Whether the controls has been unregistered.
606 - */
607 - public function unregister( $control_id ) {
608 486 if ( ! isset( $this->controls[ $control_id ] ) ) {
609 487 return false;
610 488 }
611 489
@@ -765,28 +643,12 @@
765 643
766 644 $this->stacks[ $stack_id ] = [
767 645 'tabs' => [],
768 646 'controls' => [],
769 - 'style_controls' => [],
770 - 'responsive_control_duplication_mode' => Plugin::$instance->breakpoints->get_responsive_control_duplication_mode(),
771 647 ];
772 648 }
773 649
774 650 /**
775 - * Remove existing stack from the stacks cache
776 - *
777 - * Removes the stack of a passed instance from the Controls Manager's stacks cache.
778 - *
779 - * @param Controls_Stack $controls_stack
780 - * @return void
781 - */
782 - public function delete_stack( Controls_Stack $controls_stack ) {
783 - $stack_id = $controls_stack->get_unique_name();
784 -
785 - unset( $this->stacks[ $stack_id ] );
786 - }
787 -
788 - /**
789 651 * Add control to stack.
790 652 *
791 653 * This method adds a new control to the stack.
792 654 *
@@ -806,13 +668,8 @@
806 668 'overwrite' => false,
807 669 'index' => null,
808 670 ];
809 671
810 - $control_type = 'controls';
811 - if ( Performance::should_optimize_controls() && $this->is_style_control( $control_data ) ) {
812 - $control_type = 'style_controls';
813 - }
814 -
815 672 $options = array_merge( $default_options, $options );
816 673
817 674 $default_args = [
818 675 'type' => self::TEXT,
@@ -829,17 +686,8 @@
829 686 _doing_it_wrong( sprintf( '%1$s::%2$s', __CLASS__, __FUNCTION__ ), sprintf( 'Control type "%s" not found.', esc_html( $control_data['type'] ) ), '1.0.0' );
830 687 return false;
831 688 }
832 689
833 - if ( $control_type_instance instanceof Has_Validation ) {
834 - try {
835 - $control_type_instance->validate( $control_data );
836 - } catch ( \Exception $e ) {
837 - _doing_it_wrong( sprintf( '%1$s::%2$s', __CLASS__, __FUNCTION__ ), esc_html( $e->getMessage() ), '3.23.0' );
838 - return false;
839 - }
840 - }
841 -
842 690 if ( $control_type_instance instanceof Base_Data_Control ) {
843 691 $control_default_value = $control_type_instance->get_default_value();
844 692
845 693 if ( is_array( $control_default_value ) ) {
@@ -850,9 +698,9 @@
850 698 }
851 699
852 700 $stack_id = $element->get_unique_name();
853 701
854 - if ( ! $options['overwrite'] && isset( $this->stacks[ $stack_id ][ $control_type ][ $control_id ] ) ) {
702 + if ( ! $options['overwrite'] && isset( $this->stacks[ $stack_id ]['controls'][ $control_id ] ) ) {
855 703 _doing_it_wrong( sprintf( '%1$s::%2$s', __CLASS__, __FUNCTION__ ), sprintf( 'Cannot redeclare control with same name "%s".', esc_html( $control_id ) ), '1.0.0' );
856 704
857 705 return false;
858 706 }
@@ -864,18 +712,18 @@
864 712 }
865 713
866 714 $this->stacks[ $stack_id ]['tabs'][ $control_data['tab'] ] = $tabs[ $control_data['tab'] ];
867 715
868 - $this->stacks[ $stack_id ][ $control_type ][ $control_id ] = $control_data;
716 + $this->stacks[ $stack_id ]['controls'][ $control_id ] = $control_data;
869 717
870 718 if ( null !== $options['index'] ) {
871 - $controls = $this->stacks[ $stack_id ][ $control_type ];
719 + $controls = $this->stacks[ $stack_id ]['controls'];
872 720
873 721 $controls_keys = array_keys( $controls );
874 722
875 723 array_splice( $controls_keys, $options['index'], 0, $control_id );
876 724
877 - $this->stacks[ $stack_id ][ $control_type ] = array_merge( array_flip( $controls_keys ), $controls );
725 + $this->stacks[ $stack_id ]['controls'] = array_merge( array_flip( $controls_keys ), $controls );
878 726 }
879 727
880 728 return true;
881 729 }
@@ -887,9 +735,9 @@
887 735 *
888 736 * @since 1.0.0
889 737 * @access public
890 738 *
891 - * @param string $stack_id Stack ID.
739 + * @param string $stack_id Stack ID.
892 740 * @param array|string $control_id The ID of the control to remove.
893 741 *
894 742 * @return bool|\WP_Error True if the stack was removed, False otherwise.
895 743 */
@@ -911,31 +759,8 @@
911 759 return true;
912 760 }
913 761
914 762 /**
915 - * Has Stacks Cache Been Cleared.
916 - *
917 - * @since 3.13.0
918 - * @access public
919 - * @return bool True if the CSS requires to clear the controls stack cache, False otherwise.
920 - */
921 - public function has_stacks_cache_been_cleared() {
922 - return $this->has_stacks_cache_been_cleared;
923 - }
924 -
925 - /**
926 - * Clear stack.
927 - * This method clears the stack.
928 - *
929 - * @since 3.13.0
930 - * @access public
931 - */
932 - public function clear_stack_cache() {
933 - $this->stacks = [];
934 - $this->has_stacks_cache_been_cleared = true;
935 - }
936 -
937 - /**
938 763 * Get control from stack.
939 764 *
940 765 * Retrieve a specific control for a given a specific stack.
941 766 *
@@ -951,19 +776,13 @@
951 776 *
952 777 * @return array|\WP_Error The control, or an error.
953 778 */
954 779 public function get_control_from_stack( $stack_id, $control_id ) {
955 - $stack_data = $this->get_stacks( $stack_id );
956 -
957 - if ( ! empty( $stack_data['controls'][ $control_id ] ) ) {
958 - return $stack_data['controls'][ $control_id ];
780 + if ( empty( $this->stacks[ $stack_id ]['controls'][ $control_id ] ) ) {
781 + return new \WP_Error( 'Cannot get a not-exists control.' );
959 782 }
960 783
961 - if ( ! empty( $stack_data['style_controls'][ $control_id ] ) ) {
962 - return $stack_data['style_controls'][ $control_id ];
963 - }
964 -
965 - return new \WP_Error( 'Cannot get a not-exists control.' );
784 + return $this->stacks[ $stack_id ]['controls'][ $control_id ];
966 785 }
967 786
968 787 /**
969 788 * Update control in stack.
@@ -1036,9 +855,9 @@
1036 855 * @access public
1037 856 *
1038 857 * @param Controls_Stack $controls_stack Controls stack.
1039 858 *
1040 - * @return null|array Stack data if it exists, `null` otherwise.
859 + * @return null|array Stack data if it exist, `null` otherwise.
1041 860 */
1042 861 public function get_element_stack( Controls_Stack $controls_stack ) {
1043 862 $stack_id = $controls_stack->get_unique_name();
1044 863
@@ -1045,13 +864,8 @@
1045 864 if ( ! isset( $this->stacks[ $stack_id ] ) ) {
1046 865 return null;
1047 866 }
1048 867
1049 - if ( $this->should_clean_stack( $this->stacks[ $stack_id ] ) ) {
1050 - $this->delete_stack( $controls_stack );
1051 - return null;
1052 - }
1053 -
1054 868 return $this->stacks[ $stack_id ];
1055 869 }
1056 870
1057 871 /**
@@ -1064,10 +878,11 @@
1064 878 * @since 1.0.0
1065 879 * @access public
1066 880 *
1067 881 * @param Controls_Stack $controls_stack .
1068 - * @param string $tab
1069 - * @param array $additional_messages
882 + * @param string $tab
883 + * @param array $additional_messages
884 + *
1070 885 */
1071 886 public function add_custom_css_controls( Controls_Stack $controls_stack, $tab = self::TAB_ADVANCED, $additional_messages = [] ) {
1072 887 $controls_stack->start_controls_section(
1073 888 'section_custom_css_pro',
@@ -1091,9 +906,9 @@
1091 906 'type' => self::RAW_HTML,
1092 907 'raw' => $this->get_teaser_template( [
1093 908 'title' => esc_html__( 'Meet Our Custom CSS', 'elementor' ),
1094 909 'messages' => $messages,
1095 - 'link' => 'https://go.elementor.com/go-pro-custom-css/',
910 + 'link' => 'https://elementor.com/pro/?utm_source=panel-custom-css&utm_campaign=gopro&utm_medium=wp-dash',
1096 911 ] ),
1097 912 ]
1098 913 );
1099 914
@@ -1107,10 +922,10 @@
1107 922 * version of elementor uses this method to display an upgrade message to
1108 923 * Elementor Pro.
1109 924 *
1110 925 * @param Controls_Stack $controls_stack .
1111 - * @param string $tab
1112 - * @param array $additional_messages
926 + * @param string $tab
927 + * @param array $additional_messages
1113 928 *
1114 929 * @return void
1115 930 */
1116 931 public function add_page_transitions_controls( Controls_Stack $controls_stack, $tab = self::TAB_ADVANCED, $additional_messages = [] ) {
@@ -1136,9 +951,9 @@
1136 951 'type' => self::RAW_HTML,
1137 952 'raw' => $this->get_teaser_template( [
1138 953 'title' => esc_html__( 'Meet Page Transitions', 'elementor' ),
1139 954 'messages' => $messages,
1140 - 'link' => 'https://go.elementor.com/go-pro-page-transitions/',
955 + 'link' => 'https://elementor.com/pro/?utm_source=panel-page-transitions&utm_campaign=gopro&utm_medium=wp-dash',
1141 956 ] ),
1142 957 ]
1143 958 );
1144 959
@@ -1148,18 +963,18 @@
1148 963 public function get_teaser_template( $texts ) {
1149 964 ob_start();
1150 965 ?>
1151 966 <div class="elementor-nerd-box">
1152 - <img class="elementor-nerd-box-icon" src="<?php echo esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ); ?>" loading="lazy" alt="<?php echo esc_attr__( 'Upgrade', 'elementor' ); ?>" />
967 + <img class="elementor-nerd-box-icon" src="<?php echo esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ); ?>" />
1153 968 <div class="elementor-nerd-box-title"><?php Utils::print_unescaped_internal_string( $texts['title'] ); ?></div>
1154 969 <?php foreach ( $texts['messages'] as $message ) { ?>
1155 970 <div class="elementor-nerd-box-message"><?php Utils::print_unescaped_internal_string( $message ); ?></div>
1156 971 <?php }
1157 972
1158 - // Show the upgrade button only if the user doesn't have Pro.
973 + // Show a `Go Pro` button only if the user doesn't have Pro.
1159 974 if ( $texts['link'] && ! Utils::has_pro() ) { ?>
1160 - <a class="elementor-button go-pro" href="<?php echo esc_url( ( $texts['link'] ) ); ?>" target="_blank">
1161 - <?php echo esc_html__( 'Upgrade Now', 'elementor' ); ?>
975 + <a class="elementor-nerd-box-link elementor-button elementor-button-default elementor-button-go-pro" href="<?php echo esc_url( Utils::get_pro_link( $texts['link'] ) ); ?>" target="_blank">
976 + <?php echo esc_html__( 'Go Pro', 'elementor' ); ?>
1162 977 </a>
1163 978 <?php } ?>
1164 979 </div>
1165 980 <?php
@@ -1167,26 +982,8 @@
1167 982 return ob_get_clean();
1168 983 }
1169 984
1170 985 /**
1171 - * Get Responsive Control Device Suffix
1172 - *
1173 - * @param array $control
1174 - * @return string $device suffix
1175 - */
1176 - public static function get_responsive_control_device_suffix( array $control ): string {
1177 - if ( ! empty( $control['responsive']['max'] ) ) {
1178 - $query_device = $control['responsive']['max'];
1179 - } elseif ( ! empty( $control['responsive']['min'] ) ) {
1180 - $query_device = $control['responsive']['min'];
1181 - } else {
1182 - return '';
1183 - }
1184 -
1185 - return 'desktop' === $query_device ? '' : '_' . $query_device;
1186 - }
1187 -
1188 - /**
1189 986 * Add custom attributes controls.
1190 987 *
1191 988 * This method adds a new control for the "Custom Attributes" feature. The free
1192 989 * version of elementor uses this method to display an upgrade message to
@@ -1191,19 +988,19 @@
1191 988 * This method adds a new control for the "Custom Attributes" feature. The free
1192 989 * version of elementor uses this method to display an upgrade message to
1193 990 * Elementor Pro.
1194 991 *
1195 - * @param Controls_Stack $controls_stack .
1196 - * @param string $tab
1197 992 * @since 2.8.3
1198 993 * @access public
994 + *
995 + * @param Controls_Stack $controls_stack.
1199 996 */
1200 - public function add_custom_attributes_controls( Controls_Stack $controls_stack, string $tab = self::TAB_ADVANCED ) {
997 + public function add_custom_attributes_controls( Controls_Stack $controls_stack ) {
1201 998 $controls_stack->start_controls_section(
1202 999 'section_custom_attributes_pro',
1203 1000 [
1204 1001 'label' => esc_html__( 'Attributes', 'elementor' ),
1205 - 'tab' => $tab,
1002 + 'tab' => self::TAB_ADVANCED,
1206 1003 ]
1207 1004 );
1208 1005
1209 1006 $controls_stack->add_control(
@@ -1214,187 +1011,12 @@
1214 1011 'title' => esc_html__( 'Meet Our Attributes', 'elementor' ),
1215 1012 'messages' => [
1216 1013 esc_html__( 'Attributes lets you add custom HTML attributes to any element.', 'elementor' ),
1217 1014 ],
1218 - 'link' => 'https://go.elementor.com/go-pro-custom-attributes/',
1015 + 'link' => 'https://elementor.com/pro/?utm_source=panel-custom-attributes&utm_campaign=gopro&utm_medium=wp-dash',
1219 1016 ] ),
1220 1017 ]
1221 1018 );
1222 1019
1223 1020 $controls_stack->end_controls_section();
1224 - }
1225 -
1226 - /**
1227 - * Check if a stack should be cleaned by the current responsive control duplication mode.
1228 - *
1229 - * @param array $stack
1230 - * @return bool
1231 - */
1232 - private function should_clean_stack( $stack ): bool {
1233 - if ( ! isset( $stack['responsive_control_duplication_mode'] ) ) {
1234 - return false;
1235 - }
1236 -
1237 - $stack_duplication_mode = $stack['responsive_control_duplication_mode'];
1238 -
1239 - // This array provides a convenient way to map human-readable mode names to numeric values for comparison.
1240 - // If the current stack's mode is greater than or equal to the current mode, then we shouldn't clean the stack.
1241 - $modes = [
1242 - 'off' => 1,
1243 - 'dynamic' => 2,
1244 - 'on' => 3,
1245 - ];
1246 -
1247 - if ( ! isset( $modes[ $stack_duplication_mode ] ) ) {
1248 - return false;
1249 - }
1250 -
1251 - $current_duplication_mode = Plugin::$instance->breakpoints->get_responsive_control_duplication_mode();
1252 -
1253 - if ( $modes[ $stack_duplication_mode ] >= $modes[ $current_duplication_mode ] ) {
1254 - return false;
1255 - }
1256 -
1257 - return true;
1258 - }
1259 -
1260 - public function add_display_conditions_controls( Controls_Stack $controls_stack ) {
1261 - if ( Utils::has_pro() ) {
1262 - return;
1263 - }
1264 -
1265 - ob_start();
1266 - ?>
1267 - <div class="e-control-display-conditions-promotion__wrapper">
1268 - <div class="e-control-display-conditions-promotion__description">
1269 - <span class="e-control-display-conditions-promotion__text">
1270 - <?php echo esc_html__( 'Display Conditions', 'elementor' ); ?>
1271 - </span>
1272 - <span class="e-control-display-conditions-promotion__lock-wrapper">
1273 - <i class="eicon-lock e-control-display-conditions-promotion"></i>
1274 - </span>
1275 - </div>
1276 - <i class="eicon-flow e-control-display-conditions-promotion"></i>
1277 - </div>
1278 - <?php
1279 - $control_template = ob_get_clean();
1280 -
1281 - $controls_stack->add_control(
1282 - 'display_conditions_pro',
1283 - [
1284 - 'type' => self::RAW_HTML,
1285 - 'separator' => 'before',
1286 - 'raw' => $control_template,
1287 - ]
1288 - );
1289 - }
1290 -
1291 - public function add_motion_effects_promotion_control( Controls_Stack $controls_stack ) {
1292 - if ( Utils::has_pro() ) {
1293 - return;
1294 - }
1295 -
1296 - $controls_stack->add_control(
1297 - 'scrolling_effects_pro',
1298 - [
1299 - 'type' => self::RAW_HTML,
1300 - 'separator' => 'before',
1301 - 'raw' => $this->promotion_switcher_control( esc_html__( 'Scrolling Effects', 'elementor' ), 'scrolling-effects' ),
1302 - ]
1303 - );
1304 -
1305 - $controls_stack->add_control(
1306 - 'mouse_effects_pro',
1307 - [
1308 - 'type' => self::RAW_HTML,
1309 - 'separator' => 'before',
1310 - 'raw' => $this->promotion_switcher_control( esc_html__( 'Mouse Effects', 'elementor' ), 'mouse-effects' ),
1311 - ]
1312 - );
1313 -
1314 - $controls_stack->add_control(
1315 - 'sticky_pro',
1316 - [
1317 - 'type' => self::RAW_HTML,
1318 - 'separator' => 'before',
1319 - 'raw' => $this->promotion_select_control( esc_html__( 'Sticky', 'elementor' ), 'sticky-effects' ),
1320 - ]
1321 - );
1322 -
1323 - $controls_stack->add_control(
1324 - 'motion_effects_promotion_divider',
1325 - [
1326 - 'type' => self::DIVIDER,
1327 - ]
1328 - );
1329 - }
1330 -
1331 - private function promotion_switcher_control( $title, $id ): string {
1332 - return '<div class="elementor-control-type-switcher elementor-label-inline e-control-motion-effects-promotion__wrapper">
1333 - <div class="elementor-control-content">
1334 - <div class="elementor-control-field">
1335 - <label>
1336 - ' . $title . '
1337 - </label>
1338 - <span class="e-control-motion-effects-promotion__lock-wrapper">
1339 - <i class="eicon-lock"></i>
1340 - </span>
1341 - <div class="elementor-control-input-wrapper">
1342 - <label class="elementor-switch elementor-control-unit-2 e-control-' . $id . '-promotion">
1343 - <input type="checkbox" class="elementor-switch-input" disabled>
1344 - <span class="elementor-switch-label" data-off="Off"></span>
1345 - <span class="elementor-switch-handle"></span>
1346 - </label>
1347 - </div>
1348 - </div>
1349 - </div>
1350 - </div>';
1351 - }
1352 -
1353 - private function promotion_select_control( $title, $id ): string {
1354 - return '<div class="elementor-control-type-select elementor-label-inline e-control-motion-effects-promotion__wrapper">
1355 - <div class="elementor-control-content">
1356 - <div class="elementor-control-field ">
1357 - <label for="sticky-motion-effect-pro">
1358 - ' . $title . '
1359 - </label>
1360 - <span class="e-control-motion-effects-promotion__lock-wrapper">
1361 - <i class="eicon-lock"></i>
1362 - </span>
1363 - <div class="elementor-control-input-wrapper elementor-control-unit-5 e-control-' . $id . '-promotion">
1364 - <div class="select-promotion elementor-control-unit-5">None</div>
1365 - </div>
1366 - </div>
1367 - </div>
1368 - </div>';
1369 - }
1370 -
1371 - private function is_style_control( $control_data ): bool {
1372 - $frontend_available = $control_data['frontend_available'] ?? false;
1373 - if ( $frontend_available ) {
1374 - return false;
1375 - }
1376 -
1377 - if ( ! empty( $control_data['control_type'] ) && 'content' === $control_data['control_type'] ) {
1378 - return false;
1379 - }
1380 -
1381 - if ( ! empty( $control_data['prefix_class'] ) ) {
1382 - return false;
1383 - }
1384 -
1385 - $render_type = $control_data['render_type'] ?? '';
1386 - if ( 'template' === $render_type ) {
1387 - return false;
1388 - }
1389 -
1390 - if ( 'ui' === $render_type ) {
1391 - return true;
1392 - }
1393 -
1394 - if ( ! empty( $control_data['selectors'] ) ) {
1395 - return true;
1396 - }
1397 -
1398 - return false;
1399 1021 }
1400 1022 }