1010use Elementor \Widget_Base ;
1111use Elementor \Controls_Manager ;
1212
13- if ( ! defined ( 'ABSPATH ' ) ) {
13+ if (! defined ('ABSPATH ' ) ) {
1414 exit ;
1515} // Exit if accessed directly
1616
2121 *
2222 * @since 1.0.0
2323 */
24- class Image extends Widget_Base {
24+ class Image extends Widget_Base
25+ {
2526
2627 /**
2728 * Retrieve the widget name.
@@ -31,7 +32,8 @@ class Image extends Widget_Base {
3132 *
3233 * @access public
3334 */
34- public function get_name () {
35+ public function get_name ()
36+ {
3537 return 'wcf--image ' ;
3638 }
3739
@@ -43,8 +45,9 @@ public function get_name() {
4345 *
4446 * @access public
4547 */
46- public function get_title () {
47- return esc_html__ ( 'Image ' , 'animation-addons-for-elementor ' );
48+ public function get_title ()
49+ {
50+ return esc_html__ ('Image ' , 'animation-addons-for-elementor ' );
4851 }
4952
5053 /**
@@ -55,7 +58,8 @@ public function get_title() {
5558 *
5659 * @access public
5760 */
58- public function get_icon () {
61+ public function get_icon ()
62+ {
5963 return 'wcf eicon-image ' ;
6064 }
6165
@@ -72,20 +76,21 @@ public function get_icon() {
7276 *
7377 * @access public
7478 */
75- public function get_categories () {
76- return [ 'weal-coder-addon ' ];
79+ public function get_categories ()
80+ {
81+ return ['weal-coder-addon ' ];
7782 }
7883
7984 /**
8085 * Requires css files.
8186 *
8287 * @return array
8388 */
84- // public function get_style_depends() {
85- // return array(
86- // 'wcf--image',
87- // );
88- // }
89+ // public function get_style_depends() {
90+ // return array(
91+ // 'wcf--image',
92+ // );
93+ // }
8994
9095 /**
9196 * Register the widget controls.
@@ -96,18 +101,19 @@ public function get_categories() {
96101 *
97102 * @access protected
98103 */
99- protected function register_controls () {
104+ protected function register_controls ()
105+ {
100106 $ this ->start_controls_section (
101107 'section_content ' ,
102108 [
103- 'label ' => esc_html__ ( 'Image ' , 'animation-addons-for-elementor ' ),
109+ 'label ' => esc_html__ ('Image ' , 'animation-addons-for-elementor ' ),
104110 ]
105111 );
106112
107113 $ this ->add_control (
108114 'image ' ,
109115 [
110- 'label ' => esc_html__ ( 'Choose Image ' , 'animation-addons-for-elementor ' ),
116+ 'label ' => esc_html__ ('Choose Image ' , 'animation-addons-for-elementor ' ),
111117 'type ' => Controls_Manager::MEDIA ,
112118 'dynamic ' => [
113119 'active ' => true ,
@@ -130,9 +136,9 @@ protected function register_controls() {
130136 $ this ->add_control (
131137 'link ' ,
132138 [
133- 'label ' => esc_html__ ( 'Link ' , 'animation-addons-for-elementor ' ),
139+ 'label ' => esc_html__ ('Link ' , 'animation-addons-for-elementor ' ),
134140 'type ' => Controls_Manager::URL ,
135- 'options ' => [ 'url ' , 'is_external ' , 'nofollow ' ],
141+ 'options ' => ['url ' , 'is_external ' , 'nofollow ' ],
136142 'default ' => [
137143 'url ' => '' ,
138144 'is_external ' => false ,
@@ -145,19 +151,19 @@ protected function register_controls() {
145151 $ this ->add_responsive_control (
146152 'align ' ,
147153 [
148- 'label ' => esc_html__ ( 'Alignment ' , 'animation-addons-for-elementor ' ),
154+ 'label ' => esc_html__ ('Alignment ' , 'animation-addons-for-elementor ' ),
149155 'type ' => Controls_Manager::CHOOSE ,
150156 'options ' => [
151157 'left ' => [
152- 'title ' => esc_html__ ( 'Left ' , 'animation-addons-for-elementor ' ),
158+ 'title ' => esc_html__ ('Left ' , 'animation-addons-for-elementor ' ),
153159 'icon ' => 'eicon-text-align-left ' ,
154160 ],
155161 'center ' => [
156- 'title ' => esc_html__ ( 'Center ' , 'animation-addons-for-elementor ' ),
162+ 'title ' => esc_html__ ('Center ' , 'animation-addons-for-elementor ' ),
157163 'icon ' => 'eicon-text-align-center ' ,
158164 ],
159165 'right ' => [
160- 'title ' => esc_html__ ( 'Right ' , 'animation-addons-for-elementor ' ),
166+ 'title ' => esc_html__ ('Right ' , 'animation-addons-for-elementor ' ),
161167 'icon ' => 'eicon-text-align-right ' ,
162168 ],
163169 ],
@@ -174,15 +180,15 @@ protected function register_controls() {
174180 $ this ->start_controls_section (
175181 'section_style_image ' ,
176182 [
177- 'label ' => esc_html__ ( 'Image ' , 'animation-addons-for-elementor ' ),
183+ 'label ' => esc_html__ ('Image ' , 'animation-addons-for-elementor ' ),
178184 'tab ' => Controls_Manager::TAB_STYLE ,
179185 ]
180186 );
181187
182188 $ this ->add_responsive_control (
183189 'width ' ,
184190 [
185- 'label ' => esc_html__ ( 'Width ' , 'animation-addons-for-elementor ' ),
191+ 'label ' => esc_html__ ('Width ' , 'animation-addons-for-elementor ' ),
186192 'type ' => Controls_Manager::SLIDER ,
187193 'default ' => [
188194 'unit ' => '% ' ,
@@ -193,7 +199,7 @@ protected function register_controls() {
193199 'mobile_default ' => [
194200 'unit ' => '% ' ,
195201 ],
196- 'size_units ' => [ 'px ' , '% ' , 'em ' , 'rem ' , 'vw ' , 'custom ' ],
202+ 'size_units ' => ['px ' , '% ' , 'em ' , 'rem ' , 'vw ' , 'custom ' ],
197203 'range ' => [
198204 '% ' => [
199205 'min ' => 1 ,
@@ -217,7 +223,7 @@ protected function register_controls() {
217223 $ this ->add_responsive_control (
218224 'space ' ,
219225 [
220- 'label ' => esc_html__ ( 'Max Width ' , 'animation-addons-for-elementor ' ),
226+ 'label ' => esc_html__ ('Max Width ' , 'animation-addons-for-elementor ' ),
221227 'type ' => Controls_Manager::SLIDER ,
222228 'default ' => [
223229 'unit ' => '% ' ,
@@ -228,7 +234,7 @@ protected function register_controls() {
228234 'mobile_default ' => [
229235 'unit ' => '% ' ,
230236 ],
231- 'size_units ' => [ 'px ' , '% ' , 'em ' , 'rem ' , 'vw ' , 'custom ' ],
237+ 'size_units ' => ['px ' , '% ' , 'em ' , 'rem ' , 'vw ' , 'custom ' ],
232238 'range ' => [
233239 '% ' => [
234240 'min ' => 1 ,
@@ -252,9 +258,9 @@ protected function register_controls() {
252258 $ this ->add_responsive_control (
253259 'height ' ,
254260 [
255- 'label ' => esc_html__ ( 'Height ' , 'animation-addons-for-elementor ' ),
261+ 'label ' => esc_html__ ('Height ' , 'animation-addons-for-elementor ' ),
256262 'type ' => Controls_Manager::SLIDER ,
257- 'size_units ' => [ 'px ' , '% ' , 'em ' , 'rem ' , 'vh ' , 'custom ' ],
263+ 'size_units ' => ['px ' , '% ' , 'em ' , 'rem ' , 'vh ' , 'custom ' ],
258264 'range ' => [
259265 'px ' => [
260266 'min ' => 1 ,
@@ -274,16 +280,17 @@ protected function register_controls() {
274280 $ this ->add_responsive_control (
275281 'object-fit ' ,
276282 [
277- 'label ' => esc_html__ ( 'Object Fit ' , 'animation-addons-for-elementor ' ),
283+ 'label ' => esc_html__ ('Object Fit ' , 'animation-addons-for-elementor ' ),
278284 'type ' => Controls_Manager::SELECT ,
279285 'condition ' => [
280286 'height[size]! ' => '' ,
281287 ],
282288 'options ' => [
283- '' => esc_html__ ( 'Default ' , 'animation-addons-for-elementor ' ),
284- 'fill ' => esc_html__ ( 'Fill ' , 'animation-addons-for-elementor ' ),
285- 'cover ' => esc_html__ ( 'Cover ' , 'animation-addons-for-elementor ' ),
286- 'contain ' => esc_html__ ( 'Contain ' , 'animation-addons-for-elementor ' ),
289+ '' => esc_html__ ('Default ' , 'animation-addons-for-elementor ' ),
290+ 'fill ' => esc_html__ ('Fill ' , 'animation-addons-for-elementor ' ),
291+ 'cover ' => esc_html__ ('Cover ' , 'animation-addons-for-elementor ' ),
292+ 'contain ' => esc_html__ ('Contain ' , 'animation-addons-for-elementor ' ),
293+ 'none ' => esc_html__ ('None ' , 'animation-addons-for-elementor ' ),
287294 ],
288295 'default ' => '' ,
289296 'selectors ' => [
@@ -295,18 +302,18 @@ protected function register_controls() {
295302 $ this ->add_responsive_control (
296303 'object-position ' ,
297304 [
298- 'label ' => esc_html__ ( 'Object Position ' , 'animation-addons-for-elementor ' ),
305+ 'label ' => esc_html__ ('Object Position ' , 'animation-addons-for-elementor ' ),
299306 'type ' => Controls_Manager::SELECT ,
300307 'options ' => [
301- 'center center ' => esc_html__ ( 'Center Center ' , 'animation-addons-for-elementor ' ),
302- 'center left ' => esc_html__ ( 'Center Left ' , 'animation-addons-for-elementor ' ),
303- 'center right ' => esc_html__ ( 'Center Right ' , 'animation-addons-for-elementor ' ),
304- 'top center ' => esc_html__ ( 'Top Center ' , 'animation-addons-for-elementor ' ),
305- 'top left ' => esc_html__ ( 'Top Left ' , 'animation-addons-for-elementor ' ),
306- 'top right ' => esc_html__ ( 'Top Right ' , 'animation-addons-for-elementor ' ),
307- 'bottom center ' => esc_html__ ( 'Bottom Center ' , 'animation-addons-for-elementor ' ),
308- 'bottom left ' => esc_html__ ( 'Bottom Left ' , 'animation-addons-for-elementor ' ),
309- 'bottom right ' => esc_html__ ( 'Bottom Right ' , 'animation-addons-for-elementor ' ),
308+ 'center center ' => esc_html__ ('Center Center ' , 'animation-addons-for-elementor ' ),
309+ 'center left ' => esc_html__ ('Center Left ' , 'animation-addons-for-elementor ' ),
310+ 'center right ' => esc_html__ ('Center Right ' , 'animation-addons-for-elementor ' ),
311+ 'top center ' => esc_html__ ('Top Center ' , 'animation-addons-for-elementor ' ),
312+ 'top left ' => esc_html__ ('Top Left ' , 'animation-addons-for-elementor ' ),
313+ 'top right ' => esc_html__ ('Top Right ' , 'animation-addons-for-elementor ' ),
314+ 'bottom center ' => esc_html__ ('Bottom Center ' , 'animation-addons-for-elementor ' ),
315+ 'bottom left ' => esc_html__ ('Bottom Left ' , 'animation-addons-for-elementor ' ),
316+ 'bottom right ' => esc_html__ ('Bottom Right ' , 'animation-addons-for-elementor ' ),
310317 ],
311318 'default ' => 'center center ' ,
312319 'selectors ' => [
@@ -326,18 +333,19 @@ protected function register_controls() {
326333 ]
327334 );
328335
329- $ this ->start_controls_tabs ( 'image_effects ' );
336+ $ this ->start_controls_tabs ('image_effects ' );
330337
331- $ this ->start_controls_tab ( 'normal ' ,
338+ $ this ->start_controls_tab (
339+ 'normal ' ,
332340 [
333- 'label ' => esc_html__ ( 'Normal ' , 'animation-addons-for-elementor ' ),
341+ 'label ' => esc_html__ ('Normal ' , 'animation-addons-for-elementor ' ),
334342 ]
335343 );
336344
337345 $ this ->add_control (
338346 'opacity ' ,
339347 [
340- 'label ' => esc_html__ ( 'Opacity ' , 'animation-addons-for-elementor ' ),
348+ 'label ' => esc_html__ ('Opacity ' , 'animation-addons-for-elementor ' ),
341349 'type ' => Controls_Manager::SLIDER ,
342350 'range ' => [
343351 'px ' => [
@@ -362,16 +370,17 @@ protected function register_controls() {
362370
363371 $ this ->end_controls_tab ();
364372
365- $ this ->start_controls_tab ( 'hover ' ,
373+ $ this ->start_controls_tab (
374+ 'hover ' ,
366375 [
367- 'label ' => esc_html__ ( 'Hover ' , 'animation-addons-for-elementor ' ),
376+ 'label ' => esc_html__ ('Hover ' , 'animation-addons-for-elementor ' ),
368377 ]
369378 );
370379
371380 $ this ->add_control (
372381 'opacity_hover ' ,
373382 [
374- 'label ' => esc_html__ ( 'Opacity ' , 'animation-addons-for-elementor ' ),
383+ 'label ' => esc_html__ ('Opacity ' , 'animation-addons-for-elementor ' ),
375384 'type ' => Controls_Manager::SLIDER ,
376385 'range ' => [
377386 'px ' => [
@@ -397,7 +406,7 @@ protected function register_controls() {
397406 $ this ->add_control (
398407 'background_hover_transition ' ,
399408 [
400- 'label ' => esc_html__ ( 'Transition Duration ' , 'animation-addons-for-elementor ' ),
409+ 'label ' => esc_html__ ('Transition Duration ' , 'animation-addons-for-elementor ' ),
401410 'type ' => Controls_Manager::SLIDER ,
402411 'range ' => [
403412 'px ' => [
@@ -414,7 +423,7 @@ protected function register_controls() {
414423 $ this ->add_control (
415424 'hover_animation ' ,
416425 [
417- 'label ' => esc_html__ ( 'Hover Animation ' , 'animation-addons-for-elementor ' ),
426+ 'label ' => esc_html__ ('Hover Animation ' , 'animation-addons-for-elementor ' ),
418427 'type ' => Controls_Manager::HOVER_ANIMATION ,
419428 ]
420429 );
@@ -435,9 +444,9 @@ protected function register_controls() {
435444 $ this ->add_responsive_control (
436445 'image_border_radius ' ,
437446 [
438- 'label ' => esc_html__ ( 'Border Radius ' , 'animation-addons-for-elementor ' ),
447+ 'label ' => esc_html__ ('Border Radius ' , 'animation-addons-for-elementor ' ),
439448 'type ' => Controls_Manager::DIMENSIONS ,
440- 'size_units ' => [ 'px ' , '% ' , 'em ' , 'rem ' , 'custom ' ],
449+ 'size_units ' => ['px ' , '% ' , 'em ' , 'rem ' , 'custom ' ],
441450 'selectors ' => [
442451 '{{WRAPPER}} img ' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; ' ,
443452 ],
@@ -467,28 +476,29 @@ protected function register_controls() {
467476 *
468477 * @access protected
469478 */
470- protected function render () {
479+ protected function render ()
480+ {
471481 $ settings = $ this ->get_settings_for_display ();
472482 $ link = $ settings ['link ' ];
473483
474- if ( empty ( $ settings ['image ' ]['url ' ] ) ) {
484+ if (empty ($ settings ['image ' ]['url ' ]) ) {
475485 return ;
476486 }
477- $ this ->add_render_attribute ( 'wrapper ' , 'class ' , 'wcf--image ' );
487+ $ this ->add_render_attribute ('wrapper ' , 'class ' , 'wcf--image ' );
478488
479- if ( ! empty ( $ link ['url ' ] ) ) {
480- $ this ->add_link_attributes ( 'link ' , $ link );
489+ if (! empty ($ link ['url ' ]) ) {
490+ $ this ->add_link_attributes ('link ' , $ link );
481491 }
482- ?>
483- <div <?php $ this ->print_render_attribute_string ( 'wrapper ' ); ?> >
484- <?php if ( $ link ['url ' ] ) { ?>
485- <a <?php $ this ->print_render_attribute_string ( 'link ' ); ?> >
492+ ?>
493+ <div <?php $ this ->print_render_attribute_string ('wrapper ' ); ?> >
494+ <?php if ($ link ['url ' ]) { ?>
495+ <a <?php $ this ->print_render_attribute_string ('link ' ); ?> >
486496 <?php } ?>
487- <?php Group_Control_Image_Size::print_attachment_image_html ( $ settings , 'image ' , 'image ' ); ?>
488- <?php if ( $ link ['url ' ] ) { ?>
489- </a>
490- <?php } ?>
491- </div>
492- <?php
497+ <?php Group_Control_Image_Size::print_attachment_image_html ($ settings , 'image ' , 'image ' ); ?>
498+ <?php if ($ link ['url ' ]) { ?>
499+ </a>
500+ <?php } ?>
501+ </div>
502+ <?php
493503 }
494504}
0 commit comments