PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.17.4
Shortcodes and extra features for Phlox theme v2.17.4
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / elementor / widgets / icon.php
auxin-elements / includes / elementor / widgets Last commit date
theme-elements 1 year ago accordion.php 1 year ago audio.php 4 years ago before-after.php 3 years ago button.php 1 year ago carousel-navigation.php 4 years ago circle-chart.php 1 year ago contact-box.php 4 years ago contact-form.php 1 year ago custom-list.php 1 year ago divider.php 4 years ago gallery.php 1 year ago gmap.php 4 years ago heading-modern.php 1 year ago icon.php 1 year ago image.php 1 year ago mailchimp.php 1 year ago modern-button.php 1 year ago products-grid.php 1 year ago quote.php 1 year ago recent-comments.php 1 year ago recent-posts-grid-carousel.php 1 year ago recent-posts-land-style.php 1 year ago recent-posts-masonry.php 1 year ago recent-posts-tiles-carousel.php 1 year ago recent-posts-tiles.php 1 year ago recent-posts-timeline.php 1 year ago recent-products.php 1 year ago responsive-table.php 1 year ago search.php 4 years ago staff.php 1 year ago svg.php 1 year ago tabs.php 1 year ago testimonial.php 1 year ago text.php 1 year ago touch-slider.php 1 year ago video.php 4 years ago
icon.php
461 lines
1 <?php
2 namespace Auxin\Plugin\CoreElements\Elementor\Elements;
3
4 use Elementor\Widget_Base;
5 use Elementor\Controls_Manager;
6 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
7
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12
13 /**
14 * Elementor icon widget.
15 *
16 * Elementor widget that displays an icon from over 600+ icons.
17 *
18 * @since 1.0.0
19 */
20 class Icon extends Widget_Base {
21
22 /**
23 * Get widget name.
24 *
25 * Retrieve icon widget name.
26 *
27 * @since 1.0.0
28 * @access public
29 *
30 * @return string Widget name.
31 */
32 public function get_name() {
33 return 'aux_icon';
34 }
35
36 /**
37 * Get widget title.
38 *
39 * Retrieve icon widget title.
40 *
41 * @since 1.0.0
42 * @access public
43 *
44 * @return string Widget title.
45 */
46 public function get_title() {
47 return __( 'Icon Picker', 'auxin-elements' );
48 }
49
50 /**
51 * Get widget icon.
52 *
53 * Retrieve icon widget icon.
54 *
55 * @since 1.0.0
56 * @access public
57 *
58 * @return string Widget icon.
59 */
60 public function get_icon() {
61 return 'eicon-favorite auxin-badge';
62 }
63
64 /**
65 * Get widget categories.
66 *
67 * Retrieve the list of categories the icon widget belongs to.
68 *
69 * Used to determine where to display the widget in the editor.
70 *
71 * @since 2.0.0
72 * @access public
73 *
74 * @return array Widget categories.
75 */
76 public function get_categories() {
77 return array( 'auxin-core' );
78 }
79
80 /**
81 * Get widget keywords.
82 *
83 * Retrieve the list of keywords the widget belongs to.
84 *
85 * @since 2.1.0
86 * @access public
87 *
88 * @return array Widget keywords.
89 */
90 public function get_keywords() {
91 return array( 'icon' );
92 }
93
94 /**
95 * Register icon widget controls.
96 *
97 * Adds different input fields to allow the user to change and customize the widget settings.
98 *
99 * @since 1.0.0
100 * @access protected
101 */
102 protected function register_controls() {
103 $this->start_controls_section(
104 'section_icon',
105 array(
106 'label' => __( 'Icon', 'auxin-elements' ),
107 )
108 );
109
110 $this->add_control(
111 'aux_new_icon',
112 array(
113 'label' => __( 'Icon', 'auxin-elements' ),
114 'type' => Controls_Manager::ICONS
115 )
116 );
117
118 $this->add_control(
119 'view',
120 array(
121 'label' => __( 'View', 'auxin-elements' ),
122 'type' => Controls_Manager::SELECT,
123 'options' => array(
124 'default' => __( 'Default', 'auxin-elements' ),
125 'stacked' => __( 'Stacked', 'auxin-elements' ),
126 'framed' => __( 'Framed', 'auxin-elements' ),
127 ),
128 'default' => 'default',
129 'prefix_class' => 'elementor-view-',
130 )
131 );
132
133 $this->add_control(
134 'shape',
135 array(
136 'label' => __( 'Shape', 'auxin-elements' ),
137 'type' => Controls_Manager::SELECT,
138 'options' => array(
139 'circle' => __( 'Circle', 'auxin-elements' ),
140 'square' => __( 'Square', 'auxin-elements' ),
141 ),
142 'default' => 'circle',
143 'condition' => array(
144 'view!' => 'default',
145 ),
146 'prefix_class' => 'elementor-shape-',
147 )
148 );
149
150 $this->add_control(
151 'link',
152 array(
153 'label' => __( 'Link', 'auxin-elements' ),
154 'type' => Controls_Manager::URL,
155 'dynamic' => array(
156 'active' => true
157 ),
158 'placeholder' => __( 'https://your-link.com', 'auxin-elements' ),
159 )
160 );
161
162 $this->add_responsive_control(
163 'align',
164 array(
165 'label' => __( 'Alignment', 'auxin-elements' ),
166 'type' => Controls_Manager::CHOOSE,
167 'options' => array(
168 'left' => array(
169 'title' => __( 'Left', 'auxin-elements' ),
170 'icon' => 'eicon-text-align-left',
171 ),
172 'center' => array(
173 'title' => __( 'Center', 'auxin-elements' ),
174 'icon' => 'eicon-text-align-center',
175 ),
176 'right' => array(
177 'title' => __( 'Right', 'auxin-elements' ),
178 'icon' => 'eicon-text-align-right',
179 ),
180 ),
181 'default' => 'center',
182 'selectors' => array(
183 '{{WRAPPER}} .elementor-icon-wrapper' => 'text-align: {{VALUE}};',
184 ),
185 )
186 );
187
188 $this->end_controls_section();
189
190 $this->start_controls_section(
191 'section_style_icon',
192 array(
193 'label' => __( 'Icon', 'auxin-elements' ),
194 'tab' => Controls_Manager::TAB_STYLE,
195 )
196 );
197
198 $this->start_controls_tabs( 'icon_colors' );
199
200 $this->start_controls_tab(
201 'icon_colors_normal',
202 array(
203 'label' => __( 'Normal', 'auxin-elements' ),
204 )
205 );
206
207 $this->add_control(
208 'primary_color',
209 array(
210 'label' => __( 'Primary Color', 'auxin-elements' ),
211 'type' => Controls_Manager::COLOR,
212 'default' => '',
213 'selectors' => array(
214 '{{WRAPPER}}.elementor-view-stacked .elementor-icon' => 'background-color: {{VALUE}};',
215 '{{WRAPPER}}.elementor-view-framed .elementor-icon, {{WRAPPER}}.elementor-view-default .elementor-icon' => 'color: {{VALUE}}; border-color: {{VALUE}};',
216 ),
217 'global' => [
218 'default' => Global_Colors::COLOR_PRIMARY,
219 ],
220 )
221 );
222
223 $this->add_control(
224 'secondary_color',
225 array(
226 'label' => __( 'Secondary Color', 'auxin-elements' ),
227 'type' => Controls_Manager::COLOR,
228 'default' => '',
229 'condition' => array(
230 'view!' => 'default',
231 ),
232 'selectors' => array(
233 '{{WRAPPER}}.elementor-view-framed .elementor-icon' => 'background-color: {{VALUE}};',
234 '{{WRAPPER}}.elementor-view-stacked .elementor-icon' => 'color: {{VALUE}};',
235 ),
236 )
237 );
238
239 $this->end_controls_tab();
240
241 $this->start_controls_tab(
242 'icon_colors_hover',
243 array(
244 'label' => __( 'Hover', 'auxin-elements' ),
245 )
246 );
247
248 $this->add_control(
249 'hover_primary_color',
250 array(
251 'label' => __( 'Primary Color', 'auxin-elements' ),
252 'type' => Controls_Manager::COLOR,
253 'default' => '',
254 'selectors' => array(
255 '{{WRAPPER}}.elementor-view-stacked .elementor-icon:hover' => 'background-color: {{VALUE}};',
256 '{{WRAPPER}}.elementor-view-framed .elementor-icon:hover, {{WRAPPER}}.elementor-view-default .elementor-icon:hover' => 'color: {{VALUE}}; border-color: {{VALUE}};',
257 ),
258 )
259 );
260
261 $this->add_control(
262 'hover_secondary_color',
263 array(
264 'label' => __( 'Secondary Color', 'auxin-elements' ),
265 'type' => Controls_Manager::COLOR,
266 'default' => '',
267 'condition' => array(
268 'view!' => 'default',
269 ),
270 'selectors' => array(
271 '{{WRAPPER}}.elementor-view-framed .elementor-icon:hover' => 'background-color: {{VALUE}};',
272 '{{WRAPPER}}.elementor-view-stacked .elementor-icon:hover' => 'color: {{VALUE}};',
273 ),
274 )
275 );
276
277 $this->add_control(
278 'hover_animation',
279 array(
280 'label' => __( 'Hover Animation', 'auxin-elements' ),
281 'type' => Controls_Manager::HOVER_ANIMATION,
282 )
283 );
284
285 $this->end_controls_tab();
286
287 $this->end_controls_tabs();
288
289 $this->add_control(
290 'size',
291 array(
292 'label' => __( 'Size', 'auxin-elements' ),
293 'type' => Controls_Manager::SLIDER,
294 'range' => array(
295 'px' => array(
296 'min' => 6,
297 'max' => 300,
298 ),
299 ),
300 'selectors' => array(
301 '{{WRAPPER}} .elementor-icon' => 'font-size: {{SIZE}}{{UNIT}};',
302 ),
303 )
304 );
305
306 $this->add_control(
307 'icon_padding',
308 array(
309 'label' => __( 'Padding', 'auxin-elements' ),
310 'type' => Controls_Manager::SLIDER,
311 'selectors' => array(
312 '{{WRAPPER}} .elementor-icon' => 'padding: {{SIZE}}{{UNIT}};',
313 ),
314 'range' => array(
315 'em' => array(
316 'min' => 0,
317 'max' => 5,
318 ),
319 ),
320 'condition' => array(
321 'view!' => 'default',
322 ),
323 )
324 );
325
326 $this->add_control(
327 'rotate',
328 array(
329 'label' => __( 'Rotate', 'auxin-elements' ),
330 'type' => Controls_Manager::SLIDER,
331 'default' => array(
332 'size' => 0,
333 'unit' => 'deg',
334 ),
335 'selectors' => array(
336 '{{WRAPPER}} .elementor-icon i' => 'transform: rotate({{SIZE}}{{UNIT}});',
337 ),
338 )
339 );
340
341 $this->add_control(
342 'border_width',
343 array(
344 'label' => __( 'Border Width', 'auxin-elements' ),
345 'type' => Controls_Manager::DIMENSIONS,
346 'selectors' => array(
347 '{{WRAPPER}} .elementor-icon' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
348 ),
349 'condition' => array(
350 'view' => 'framed',
351 ),
352 )
353 );
354
355 $this->add_control(
356 'border_radius',
357 array(
358 'label' => __( 'Border Radius', 'auxin-elements' ),
359 'type' => Controls_Manager::DIMENSIONS,
360 'size_units' => array( 'px', '%' ),
361 'selectors' => array(
362 '{{WRAPPER}} .elementor-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
363 ),
364 'condition' => array(
365 'view!' => 'default',
366 ),
367 )
368 );
369
370 $this->end_controls_section();
371 }
372
373 /**
374 * Render icon widget output on the frontend.
375 *
376 * Written in PHP and used to generate the final HTML.
377 *
378 * @since 1.0.0
379 * @access protected
380 */
381 protected function render() {
382 $settings = $this->get_settings_for_display();
383
384 $this->add_render_attribute( 'wrapper', 'class', 'elementor-icon-wrapper' );
385
386 $this->add_render_attribute( 'icon-wrapper', 'class', 'elementor-icon' );
387
388 if ( ! empty( $settings['hover_animation'] ) ) {
389 $this->add_render_attribute( 'icon-wrapper', 'class', 'elementor-animation-' . $settings['hover_animation'] );
390 }
391
392 $icon_tag = 'div';
393
394 if ( ! empty( $settings['link']['url'] ) ) {
395 $this->add_render_attribute( 'icon-wrapper', 'href', esc_url( $settings['link']['url'] ) );
396 $icon_tag = 'a';
397
398 if ( ! empty( $settings['link']['is_external'] ) ) {
399 $this->add_render_attribute( 'icon-wrapper', 'target', '_blank' );
400 }
401
402 if ( $settings['link']['nofollow'] ) {
403 $this->add_render_attribute( 'icon-wrapper', 'rel', 'nofollow' );
404 }
405 }
406
407 ?>
408 <div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>>
409 <<?php echo esc_html( $icon_tag ) . ' ' . $this->get_render_attribute_string( 'icon-wrapper' ); ?>>
410 <?php
411 if ( ! empty( $settings['aux_new_icon']['value'] ) ) {
412 \Elementor\Icons_Manager::render_icon( $settings['aux_new_icon'], [ 'aria-hidden' => 'true' ] );
413 } else {
414 if ( ! empty( $settings['icon'] ) ) {
415 $this->add_render_attribute( 'icon', 'class', $settings['icon'] );
416 $this->add_render_attribute( 'icon', 'aria-hidden', 'true' );
417 ?>
418 <i <?php echo $this->get_render_attribute_string( 'icon' ); ?>></i>
419 <?php
420 }
421 }
422 ?>
423 </<?php echo esc_html( $icon_tag ); ?>>
424 </div>
425 <?php
426 }
427
428 /**
429 * Render icon widget output in the editor.
430 *
431 * Written as a Backbone JavaScript template and used to generate the live preview.
432 *
433 * @since 1.0.0
434 * @access protected
435 */
436 protected function content_template() {
437 ?>
438 <# var link = settings.link.url ? 'href="' + settings.link.url + '"' : '',
439 iconHTML = elementor.helpers.renderIcon( view, settings.aux_new_icon, { 'aria-hidden': true }, 'i' , 'object' ),
440 iconTag = link ? 'a' : 'div'; #>
441 <div class="elementor-icon-wrapper">
442 <{{{ iconTag }}} class="elementor-icon elementor-animation-{{ settings.hover_animation }}" {{{ link }}}>
443 <# if ( iconHTML && iconHTML.rendered && settings.aux_new_icon.value !== '' ) { #>
444 {{{ iconHTML.value }}}
445 <#
446 } else if ( settings.icon !== '' ) {
447 view.addRenderAttribute(
448 'iconClass',
449 {
450 'class': [ settings.icon ],
451 }
452 );
453 #>
454 <i {{{ view.getRenderAttributeString('iconClass') }}} aria-hidden="true"></i>
455 <# } #>
456 </{{{ iconTag }}}>
457 </div>
458 <?php
459 }
460 }
461