@@ -85,6 +85,39 @@ public function get_keywords()
8585 return ['embedpress ' , 'pdf ' , 'doc ' , 'docx ' , 'ppt ' , 'pptx ' , 'xls ' , 'xlsx ' , 'embedpress-document ' ];
8686 }
8787
88+ /**
89+ * Performance Settings Section
90+ */
91+ public function init_performance_controls ()
92+ {
93+ // Get global lazy load setting
94+ $ g_settings = get_option (EMBEDPRESS_PLG_NAME , []);
95+ $ lazy_load_default = isset ($ g_settings ['g_lazyload ' ]) && $ g_settings ['g_lazyload ' ] == 1 ? 'yes ' : '' ;
96+
97+ $ this ->start_controls_section (
98+ 'embedpress_performance_section ' ,
99+ [
100+ 'label ' => __ ('Performance ' , 'embedpress ' ),
101+ ]
102+ );
103+
104+ $ this ->add_control (
105+ 'enable_lazy_load ' ,
106+ [
107+ 'label ' => sprintf (__ ('Enable Lazy Loading %s ' , 'embedpress ' ), $ this ->pro_text ),
108+ 'type ' => \Elementor \Controls_Manager::SWITCHER ,
109+ 'label_on ' => __ ('Yes ' , 'embedpress ' ),
110+ 'label_off ' => __ ('No ' , 'embedpress ' ),
111+ 'return_value ' => 'yes ' ,
112+ 'default ' => $ lazy_load_default ,
113+ 'description ' => __ ('Load iframe only when it enters the viewport for better performance ' , 'embedpress ' ),
114+ 'classes ' => $ this ->pro_class ,
115+ ]
116+ );
117+
118+ $ this ->end_controls_section ();
119+ }
120+
88121 protected function register_controls ()
89122 {
90123 $ class = 'embedpress-pro-control not-active ' ;
@@ -277,24 +310,7 @@ protected function register_controls()
277310
278311 $ this ->init_branding_controls ( 'document ' );
279312
280- // Get global lazy load setting
281- $ g_settings = get_option (EMBEDPRESS_PLG_NAME , []);
282- $ lazy_load_default = isset ($ g_settings ['g_lazyload ' ]) && $ g_settings ['g_lazyload ' ] == 1 ? 'yes ' : '' ;
283-
284- $ this ->add_control (
285- 'enable_lazy_load ' ,
286- [
287- 'label ' => sprintf (__ ('Enable Lazy Loading %s ' , 'embedpress ' ), $ this ->pro_text ),
288- 'type ' => \Elementor \Controls_Manager::SWITCHER ,
289- 'label_on ' => __ ('Yes ' , 'embedpress ' ),
290- 'label_off ' => __ ('No ' , 'embedpress ' ),
291- 'return_value ' => 'yes ' ,
292- 'default ' => $ lazy_load_default ,
293- 'separator ' => 'before ' ,
294- 'description ' => __ ('Load iframe only when it enters the viewport for better performance ' , 'embedpress ' ),
295- 'classes ' => $ this ->pro_class ,
296- ]
297- );
313+
298314
299315 $ this ->end_controls_section ();
300316
@@ -451,6 +467,8 @@ protected function register_controls()
451467 $ this ->end_controls_section ();
452468
453469 do_action ( 'extend_elementor_controls ' , $ this , '_doc_ ' , $ this ->pro_text , $ this ->pro_class );
470+
471+ $ this ->init_performance_controls ();
454472
455473 }
456474
0 commit comments