PluginProbe
Elementor Website Builder – more than just a page builder / 3.5.2
Elementor Website Builder – more than just a page builder v3.5.2
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 +53 -348 4.2.0-dev23.5.2 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,11 +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 361 'text-stroke',
400 362 ];
401 363 }
402 364
@@ -417,10 +379,8 @@
417 379 self::TAB,
418 380 self::TABS,
419 381 self::DIVIDER,
420 382 self::DEPRECATED_NOTICE,
421 - self::ALERT,
422 - self::NOTICE,
423 383
424 384 self::COLOR,
425 385 self::MEDIA,
426 386 self::SLIDER,
@@ -425,14 +385,12 @@
425 385 self::MEDIA,
426 386 self::SLIDER,
427 387 self::DIMENSIONS,
428 388 self::CHOOSE,
429 - self::VISUAL_CHOICE,
430 389 self::WYSIWYG,
431 390 self::CODE,
432 391 self::FONT,
433 392 self::IMAGE_DIMENSIONS,
434 - self::GAPS,
435 393
436 394 self::WP_WIDGET,
437 395
438 396 self::URL,
@@ -494,14 +452,14 @@
494 452 *
495 453 * @param Controls_Manager $this The controls manager.
496 454 */
497 455 // 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 - // );
456 + //Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->do_deprecated_action(
457 + // 'elementor/controls/controls_registered',
458 + // [ $this ],
459 + // '3.5.0',
460 + // 'elementor/controls/register'
461 + //);
504 462
505 463 do_action( 'elementor/controls/controls_registered', $this );
506 464
507 465 /**
@@ -523,9 +481,9 @@
523 481 * control to any given control instance.
524 482 *
525 483 * @since 1.0.0
526 484 * @access public
527 - * @deprecated 3.5.0 Use `register()` method instead.
485 + * @deprecated 3.5.0 Use `$this->register()` instead.
528 486 *
529 487 * @param string $control_id Control ID.
530 488 * @param Base_Control $control_instance Control instance, usually the
531 489 * current instance.
@@ -531,13 +489,13 @@
531 489 * current instance.
532 490 */
533 491 public function register_control( $control_id, Base_Control $control_instance ) {
534 492 // 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 - // );
493 + //Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function(
494 + // __METHOD__,
495 + // '3.5.0',
496 + // 'register'
497 + //);
540 498
541 499 $this->register( $control_instance, $control_id );
542 500 }
543 501
@@ -555,18 +513,20 @@
555 513 *
556 514 * @return void
557 515 */
558 516 public function register( Base_Control $control_instance, $control_id = null ) {
517 + // TODO: Uncomment when Pro uses the new hook.
559 518
560 519 // 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 - }
520 + //if ( $control_id ) {
521 + // Plugin::instance()->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_argument(
522 + // '$control_id', '3.5.0'
523 + // );
524 + //} else {
525 + //}
568 526
527 + $control_id = $control_instance->get_type();
528 +
569 529 $this->controls[ $control_id ] = $control_instance;
570 530 }
571 531
572 532 /**
@@ -575,9 +535,9 @@
575 535 * This method removes control from the controls list.
576 536 *
577 537 * @since 1.0.0
578 538 * @access public
579 - * @deprecated 3.5.0 Use `unregister()` method instead.
539 + * @deprecated 3.5.0 Use `$this->unregister()` instead.
580 540 *
581 541 * @param string $control_id Control ID.
582 542 *
583 543 * @return bool True if the control was removed, False otherwise.
@@ -582,13 +542,14 @@
582 542 *
583 543 * @return bool True if the control was removed, False otherwise.
584 544 */
585 545 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 - );
546 + // TODO: Uncomment when Pro uses the new hook.
547 + //Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function(
548 + // __METHOD__,
549 + // '3.5.0',
550 + // 'unregister'
551 + //);
591 552
592 553 return $this->unregister( $control_id );
593 554 }
594 555
@@ -765,28 +726,12 @@
765 726
766 727 $this->stacks[ $stack_id ] = [
767 728 'tabs' => [],
768 729 'controls' => [],
769 - 'style_controls' => [],
770 - 'responsive_control_duplication_mode' => Plugin::$instance->breakpoints->get_responsive_control_duplication_mode(),
771 730 ];
772 731 }
773 732
774 733 /**
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 734 * Add control to stack.
790 735 *
791 736 * This method adds a new control to the stack.
792 737 *
@@ -806,13 +751,8 @@
806 751 'overwrite' => false,
807 752 'index' => null,
808 753 ];
809 754
810 - $control_type = 'controls';
811 - if ( Performance::should_optimize_controls() && $this->is_style_control( $control_data ) ) {
812 - $control_type = 'style_controls';
813 - }
814 -
815 755 $options = array_merge( $default_options, $options );
816 756
817 757 $default_args = [
818 758 'type' => self::TEXT,
@@ -829,17 +769,8 @@
829 769 _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 770 return false;
831 771 }
832 772
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 773 if ( $control_type_instance instanceof Base_Data_Control ) {
843 774 $control_default_value = $control_type_instance->get_default_value();
844 775
845 776 if ( is_array( $control_default_value ) ) {
@@ -850,9 +781,9 @@
850 781 }
851 782
852 783 $stack_id = $element->get_unique_name();
853 784
854 - if ( ! $options['overwrite'] && isset( $this->stacks[ $stack_id ][ $control_type ][ $control_id ] ) ) {
785 + if ( ! $options['overwrite'] && isset( $this->stacks[ $stack_id ]['controls'][ $control_id ] ) ) {
855 786 _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 787
857 788 return false;
858 789 }
@@ -864,18 +795,18 @@
864 795 }
865 796
866 797 $this->stacks[ $stack_id ]['tabs'][ $control_data['tab'] ] = $tabs[ $control_data['tab'] ];
867 798
868 - $this->stacks[ $stack_id ][ $control_type ][ $control_id ] = $control_data;
799 + $this->stacks[ $stack_id ]['controls'][ $control_id ] = $control_data;
869 800
870 801 if ( null !== $options['index'] ) {
871 - $controls = $this->stacks[ $stack_id ][ $control_type ];
802 + $controls = $this->stacks[ $stack_id ]['controls'];
872 803
873 804 $controls_keys = array_keys( $controls );
874 805
875 806 array_splice( $controls_keys, $options['index'], 0, $control_id );
876 807
877 - $this->stacks[ $stack_id ][ $control_type ] = array_merge( array_flip( $controls_keys ), $controls );
808 + $this->stacks[ $stack_id ]['controls'] = array_merge( array_flip( $controls_keys ), $controls );
878 809 }
879 810
880 811 return true;
881 812 }
@@ -887,9 +818,9 @@
887 818 *
888 819 * @since 1.0.0
889 820 * @access public
890 821 *
891 - * @param string $stack_id Stack ID.
822 + * @param string $stack_id Stack ID.
892 823 * @param array|string $control_id The ID of the control to remove.
893 824 *
894 825 * @return bool|\WP_Error True if the stack was removed, False otherwise.
895 826 */
@@ -911,31 +842,8 @@
911 842 return true;
912 843 }
913 844
914 845 /**
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 846 * Get control from stack.
939 847 *
940 848 * Retrieve a specific control for a given a specific stack.
941 849 *
@@ -951,19 +859,13 @@
951 859 *
952 860 * @return array|\WP_Error The control, or an error.
953 861 */
954 862 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 ];
863 + if ( empty( $this->stacks[ $stack_id ]['controls'][ $control_id ] ) ) {
864 + return new \WP_Error( 'Cannot get a not-exists control.' );
959 865 }
960 866
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.' );
867 + return $this->stacks[ $stack_id ]['controls'][ $control_id ];
966 868 }
967 869
968 870 /**
969 871 * Update control in stack.
@@ -1036,9 +938,9 @@
1036 938 * @access public
1037 939 *
1038 940 * @param Controls_Stack $controls_stack Controls stack.
1039 941 *
1040 - * @return null|array Stack data if it exists, `null` otherwise.
942 + * @return null|array Stack data if it exist, `null` otherwise.
1041 943 */
1042 944 public function get_element_stack( Controls_Stack $controls_stack ) {
1043 945 $stack_id = $controls_stack->get_unique_name();
1044 946
@@ -1045,13 +947,8 @@
1045 947 if ( ! isset( $this->stacks[ $stack_id ] ) ) {
1046 948 return null;
1047 949 }
1048 950
1049 - if ( $this->should_clean_stack( $this->stacks[ $stack_id ] ) ) {
1050 - $this->delete_stack( $controls_stack );
1051 - return null;
1052 - }
1053 -
1054 951 return $this->stacks[ $stack_id ];
1055 952 }
1056 953
1057 954 /**
@@ -1064,10 +961,11 @@
1064 961 * @since 1.0.0
1065 962 * @access public
1066 963 *
1067 964 * @param Controls_Stack $controls_stack .
1068 - * @param string $tab
1069 - * @param array $additional_messages
965 + * @param string $tab
966 + * @param array $additional_messages
967 + *
1070 968 */
1071 969 public function add_custom_css_controls( Controls_Stack $controls_stack, $tab = self::TAB_ADVANCED, $additional_messages = [] ) {
1072 970 $controls_stack->start_controls_section(
1073 971 'section_custom_css_pro',
@@ -1091,9 +989,9 @@
1091 989 'type' => self::RAW_HTML,
1092 990 'raw' => $this->get_teaser_template( [
1093 991 'title' => esc_html__( 'Meet Our Custom CSS', 'elementor' ),
1094 992 'messages' => $messages,
1095 - 'link' => 'https://go.elementor.com/go-pro-custom-css/',
993 + 'link' => 'https://elementor.com/pro/?utm_source=panel-custom-css&utm_campaign=gopro&utm_medium=wp-dash',
1096 994 ] ),
1097 995 ]
1098 996 );
1099 997
@@ -1107,10 +1005,10 @@
1107 1005 * version of elementor uses this method to display an upgrade message to
1108 1006 * Elementor Pro.
1109 1007 *
1110 1008 * @param Controls_Stack $controls_stack .
1111 - * @param string $tab
1112 - * @param array $additional_messages
1009 + * @param string $tab
1010 + * @param array $additional_messages
1113 1011 *
1114 1012 * @return void
1115 1013 */
1116 1014 public function add_page_transitions_controls( Controls_Stack $controls_stack, $tab = self::TAB_ADVANCED, $additional_messages = [] ) {
@@ -1136,9 +1034,9 @@
1136 1034 'type' => self::RAW_HTML,
1137 1035 'raw' => $this->get_teaser_template( [
1138 1036 'title' => esc_html__( 'Meet Page Transitions', 'elementor' ),
1139 1037 'messages' => $messages,
1140 - 'link' => 'https://go.elementor.com/go-pro-page-transitions/',
1038 + 'link' => 'https://elementor.com/pro/?utm_source=panel-page-transitions&utm_campaign=gopro&utm_medium=wp-dash',
1141 1039 ] ),
1142 1040 ]
1143 1041 );
1144 1042
@@ -1148,18 +1046,18 @@
1148 1046 public function get_teaser_template( $texts ) {
1149 1047 ob_start();
1150 1048 ?>
1151 1049 <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' ); ?>" />
1050 + <img class="elementor-nerd-box-icon" src="<?php echo esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ); ?>" />
1153 1051 <div class="elementor-nerd-box-title"><?php Utils::print_unescaped_internal_string( $texts['title'] ); ?></div>
1154 1052 <?php foreach ( $texts['messages'] as $message ) { ?>
1155 1053 <div class="elementor-nerd-box-message"><?php Utils::print_unescaped_internal_string( $message ); ?></div>
1156 1054 <?php }
1157 1055
1158 - // Show the upgrade button only if the user doesn't have Pro.
1056 + // Show a `Go Pro` button only if the user doesn't have Pro.
1159 1057 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' ); ?>
1058 + <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">
1059 + <?php echo esc_html__( 'Go Pro', 'elementor' ); ?>
1162 1060 </a>
1163 1061 <?php } ?>
1164 1062 </div>
1165 1063 <?php
@@ -1167,26 +1065,8 @@
1167 1065 return ob_get_clean();
1168 1066 }
1169 1067
1170 1068 /**
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 1069 * Add custom attributes controls.
1190 1070 *
1191 1071 * This method adds a new control for the "Custom Attributes" feature. The free
1192 1072 * version of elementor uses this method to display an upgrade message to
@@ -1191,19 +1071,19 @@
1191 1071 * This method adds a new control for the "Custom Attributes" feature. The free
1192 1072 * version of elementor uses this method to display an upgrade message to
1193 1073 * Elementor Pro.
1194 1074 *
1195 - * @param Controls_Stack $controls_stack .
1196 - * @param string $tab
1197 1075 * @since 2.8.3
1198 1076 * @access public
1077 + *
1078 + * @param Controls_Stack $controls_stack.
1199 1079 */
1200 - public function add_custom_attributes_controls( Controls_Stack $controls_stack, string $tab = self::TAB_ADVANCED ) {
1080 + public function add_custom_attributes_controls( Controls_Stack $controls_stack ) {
1201 1081 $controls_stack->start_controls_section(
1202 1082 'section_custom_attributes_pro',
1203 1083 [
1204 1084 'label' => esc_html__( 'Attributes', 'elementor' ),
1205 - 'tab' => $tab,
1085 + 'tab' => self::TAB_ADVANCED,
1206 1086 ]
1207 1087 );
1208 1088
1209 1089 $controls_stack->add_control(
@@ -1214,187 +1094,12 @@
1214 1094 'title' => esc_html__( 'Meet Our Attributes', 'elementor' ),
1215 1095 'messages' => [
1216 1096 esc_html__( 'Attributes lets you add custom HTML attributes to any element.', 'elementor' ),
1217 1097 ],
1218 - 'link' => 'https://go.elementor.com/go-pro-custom-attributes/',
1098 + 'link' => 'https://elementor.com/pro/?utm_source=panel-custom-attributes&utm_campaign=gopro&utm_medium=wp-dash',
1219 1099 ] ),
1220 1100 ]
1221 1101 );
1222 1102
1223 1103 $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-upgrade-crown-full 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-upgrade-crown-full"></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-upgrade-crown-full"></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">' . esc_html__( 'None', 'elementor' ) . '</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 1104 }
1400 1105 }