PluginProbe
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code / 3.4.3
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code v3.4.3
5.5.3 3.1.0 3.2.0 3.2.1 3.3.0 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.6.0 3.7.0 3.8.0 3.8.1 3.8.2 3.8.3 4.0.0 4.0.2 4.0.3 4.0.4 4.0.5 4.1.0 4.1.1 All 78 releases
copy-the-code / classes / class-helpers.php

class-helpers.php in Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code 3.4.3, at classes/class-helpers.php

738 lines 27.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Helpers
4 *
5 * @package Copy the Code
6 * @since 1.0.0
7 */
8
9 namespace CopyTheCode;
10
11 use Elementor\Controls_Manager;
12 use Elementor\Group_Control_Background;
13 use Elementor\Group_Control_Typography;
14 use Elementor\Group_Control_Border;
15 use Elementor\Group_Control_Box_Shadow;
16
17 /**
18 * Helpers
19 *
20 * @since 1.0.0
21 */
22 class Helpers {
23 public static function get_svg_copy_icon() {
24 return '<svg aria-hidden="true" focusable="false" role="img" class="copy-icon" viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg>';
25 }
26
27 public static function get_svg_checked_icon() {
28 return '<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="check-icon" fill="currentColor"><path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg>';
29 }
30
31 public static function get_copy_button( $args = [] ) {
32 $show_icon = isset( $args['show_icon'] ) ? $args['show_icon'] : 'yes';
33 $with_icon = 'yes' === $show_icon ? 'with-icon' : 'without-icon';
34 $as_raw = isset( $args['as_raw'] ) ? 'yes' : '';
35 $button_text = isset( $args['button_text'] ) ? $args['button_text'] : esc_html__( 'Copy', 'copy-the-code' );
36 $button_class = isset( $args['button_class'] ) ? $args['button_class'] : '';
37 $button_text_copied = isset( $args['button_text_copied'] ) ? $args['button_text_copied'] : esc_html__( 'Copied!', 'copy-the-code' );
38 $icon_direction = isset( $args['icon_direction'] ) ? $args['icon_direction'] : 'before';
39
40 ob_start();
41 ?>
42 <button class="ctc-block-copy ctc-<?php echo esc_attr( $with_icon ); ?>" copy-as-raw='<?php echo esc_html( $as_raw ); ?>' data-copied="<?php echo esc_html( $button_text_copied ); ?>">
43 <?php
44 if ( 'before' === $icon_direction && 'yes' === $show_icon ) {
45 echo self::get_svg_copy_icon();
46 echo self::get_svg_checked_icon();
47 }
48 echo '<span class="ctc-button-text">' . esc_html( $button_text ) . '</span>';
49 if ( 'after' === $icon_direction && 'yes' === $show_icon ) {
50 echo self::get_svg_copy_icon();
51 echo self::get_svg_checked_icon();
52 }
53 ?>
54 </button>
55 <?php
56 return ob_get_clean();
57 }
58
59 /**
60 * Is shortcode used
61 *
62 * @param string $shortcode
63 * @since 3.1.0
64 */
65 public static function is_shortcode_used( $shortcode = '' ) {
66 global $post;
67 if ( ! $post ) {
68 return false;
69 }
70
71 $found = false;
72 if ( has_shortcode( $post->post_content, $shortcode ) ) {
73 $found = true;
74 }
75
76 return $found;
77 }
78
79 /**
80 * Get categories
81 *
82 * @since 3.2.0
83 */
84 public static function get_categories() {
85 return [ 'copy-the-code', 'basic' ];
86 }
87
88 /**
89 * Get common keywords
90 *
91 * @param array $keywords New keywords.
92 * @since 3.2.0
93 */
94 public static function get_keywords( $keywords = [] ) {
95 $default = [ 'copy', 'paste', 'clipboard', 'copy clipboard', 'copy to clipboard', 'copy anything to clipboard' ];
96
97 return array_merge( $default, $keywords );
98 }
99
100 /**
101 * Register "Copy Content" Section
102 *
103 * @param object $self
104 */
105 public static function register_copy_content_section( $self, $args = [] ) {
106 $self->start_controls_section(
107 'copy_content_section',
108 [
109 'label' => esc_html__( 'Hidden Copy Content', 'copy-the-code' ),
110 ]
111 );
112
113 if ( isset( $args['before_controls'] ) ) {
114 foreach ( $args['before_controls'] as $control_id => $options ) {
115 $self->add_control( $control_id, $options );
116 }
117 }
118
119 $self->add_control(
120 'copy_content',
121 [
122 'label' => isset( $args[ 'label' ] ) ? $args[ 'label' ] : esc_html__( 'Enter Text that Copy to Clipboard', 'copy-the-code' ),
123 'type' => Controls_Manager::TEXTAREA,
124 'default' => isset( $args[ 'default' ] ) ? $args[ 'default' ] : '',
125 'rows' => 10,
126 ]
127 );
128
129 if ( isset( $args['after_controls'] ) ) {
130 foreach ( $args['after_controls'] as $control_id => $options ) {
131 $self->add_control( $control_id, $options );
132 }
133 }
134
135 $self->end_controls_section();
136 }
137
138 /**
139 * Register "Copy Button" Section
140 *
141 * @param array $args
142 * @param object $self
143 */
144 public static function register_copy_button_section( $self, $args = [] ) {
145 $default = [
146 'button_text' => isset( $args[ 'button_text' ] ) ? $args[ 'button_text' ] : esc_html__( 'Copy to Clipboard', 'copy-the-code' ),
147 'button_text_copied' => isset( $args[ 'button_text_copied' ] ) ? $args[ 'button_text_copied' ] : esc_html__( 'Copied!', 'copy-the-code' ),
148 'show_icon' => 'yes',
149 'icon_direction' => 'before',
150 ];
151
152 $self->start_controls_section(
153 'copy_button_section',
154 [
155 'label' => esc_html__( 'Copy Button', 'copy-the-code' ),
156 ]
157 );
158
159 $self->add_control(
160 'copy_button_text',
161 [
162 'label' => esc_html__( 'Button Text', 'copy-the-code' ),
163 'type' => Controls_Manager::TEXT,
164 'default' => $default[ 'button_text' ],
165 ]
166 );
167
168 $self->add_control(
169 'copy_button_text_copied',
170 [
171 'label' => esc_html__( 'After Copy Text', 'copy-the-code' ),
172 'type' => Controls_Manager::TEXT,
173 'default' => $default[ 'button_text_copied' ],
174 ]
175 );
176
177 // Alignment.
178 $self->add_responsive_control(
179 'copy_button_align',
180 [
181 'label' => esc_html__( 'Alignment', 'copy-the-code' ),
182 'type' => Controls_Manager::CHOOSE,
183 'options' => [
184 'left' => [
185 'title' => esc_html__( 'Left', 'copy-the-code' ),
186 'icon' => 'eicon-text-align-left',
187 ],
188 'center' => [
189 'title' => esc_html__( 'Center', 'copy-the-code' ),
190 'icon' => 'eicon-text-align-center',
191 ],
192 'right' => [
193 'title' => esc_html__( 'Right', 'copy-the-code' ),
194 'icon' => 'eicon-text-align-right',
195 ],
196 ],
197 'selectors' => [
198 '{{WRAPPER}} .ctc-block-actions' => 'text-align: {{VALUE}};',
199 ],
200 ]
201 );
202
203 // Show Icon.
204 $self->add_control(
205 'copy_show_icon',
206 [
207 'label' => esc_html__( 'Show Icon', 'copy-the-code' ),
208 'type' => Controls_Manager::SWITCHER,
209 'label_on' => esc_html__( 'Show', 'copy-the-code' ),
210 'label_off' => esc_html__( 'Hide', 'copy-the-code' ),
211 'return_value' => 'yes',
212 'default' => 'yes',
213 ]
214 );
215
216 $self->add_control(
217 'copy_icon_direction',
218 [
219 'label' => esc_html__( 'Icon Direction', 'copy-the-code' ),
220 'type' => Controls_Manager::SELECT,
221 'default' => 'before',
222 'options' => [
223 'before' => esc_html__( 'Before', 'copy-the-code' ),
224 'after' => esc_html__( 'After', 'copy-the-code' ),
225 ],
226 'condition' => [
227 'copy_show_icon' => 'yes',
228 ],
229 ]
230 );
231
232 $self->add_responsive_control(
233 'copy_icon_text_gap',
234 [
235 'label' => esc_html__( 'Icon and Text Gap', 'copy-the-code' ),
236 'type' => Controls_Manager::SLIDER,
237 'size_units' => [ 'px', 'em' ],
238 'range' => [
239 'px' => [
240 'min' => 0,
241 'max' => 100,
242 ],
243 'em' => [
244 'min' => 0,
245 'max' => 10,
246 ],
247 ],
248 'selectors' => [
249 '{{WRAPPER}} .ctc-with-icon' => 'gap: {{SIZE}}{{UNIT}};',
250 ],
251 'condition' => [
252 'copy_show_icon' => 'yes',
253 ],
254 ]
255 );
256
257 $self->end_controls_section();
258 }
259
260 /**
261 * Register "Copy Button Style" Section
262 *
263 * @param object $self
264 */
265 public static function register_copy_button_style_section( $self ) {
266 self::register_style_section( $self, 'Copy Button', '.ctc-block-copy', [
267 'text_align' => false,
268 'normal_text_color' => [
269 'selectors' => [
270 '{{WRAPPER}} .ctc-block-copy' => 'color: {{VALUE}};',
271 '{{WRAPPER}} .ctc-block-copy svg' => 'fill: {{VALUE}};',
272 ]
273 ],
274 'hover_text_color' => [
275 'selectors' => [
276 '{{WRAPPER}} .ctc-block-copy:hover' => 'color: {{VALUE}};',
277 '{{WRAPPER}} .ctc-block-copy:hover svg' => 'fill: {{VALUE}};',
278 ]
279 ],
280 ] );
281 }
282
283 /**
284 * Render "Copy Button"
285 *
286 * @param object $self
287 */
288 public static function render_copy_button( $self ) {
289 $button_text = $self->get_settings_for_display( 'copy_button_text' );
290 $button_text_copied = $self->get_settings_for_display( 'copy_button_text_copied' );
291 $show_icon = $self->get_settings_for_display( 'copy_show_icon' );
292 $icon_direction = $self->get_settings_for_display( 'copy_icon_direction' );
293
294 echo Helpers::get_copy_button( [
295 'as_raw' => 'yes',
296 'button_text' => $button_text,
297 'button_text_copied' => $button_text_copied,
298 'icon_direction' => $icon_direction,
299 'show_icon' => $show_icon,
300 ] );
301 }
302
303 /**
304 * Render "Copy Content"
305 *
306 * @param object $self
307 * @param array $args
308 */
309 public static function render_copy_content( $self, $args = [] ) {
310 $content = isset( $args[ 'content' ] ) ? $args[ 'content' ] : $self->get_settings_for_display( 'copy_content' );
311 ?>
312 <textarea class="ctc-copy-content" style="display: none;"><?php echo wp_kses_post( apply_shortcodes( $content ) ); ?></textarea>
313 <?php
314 }
315
316 /**
317 * Register "Get Pro" Section
318 *
319 * @param object $self
320 * @param array $args
321 */
322 public static function register_pro_section( $self, $label ) {
323 $id = str_replace( ' ', '-', $label );
324 $id = strtolower( $id );
325
326 $self->start_controls_section(
327 $id . '_box',
328 [
329 'label' => $label . ' (Pro)',
330 'tab' => Controls_Manager::TAB_STYLE,
331 ]
332 );
333
334 // Buy pro.
335 $self->add_control(
336 $id . '_box_content',
337 [
338 'type' => Controls_Manager::RAW_HTML,
339 'raw' => '<div style="text-align: center;"><h2 style="font-weight: 600;margin: 0 0 10px 0;font-size: 14px;">Unlock Premium Features!</h2><p style="margin: 0 0 10px 0;">Upgrade to Clipboard Pro for enhanced functionality and exclusive benefits.</p><p style="margin: 0 0 10px 0;">Ready to level up your experience?</p><a href="https://clipboard.agency/#pricing" class="button button-primary" target="_blank">See Pricing Plans</a></div>',
340 ]
341 );
342
343 $self->end_controls_section();
344 }
345
346 /**
347 * Register "Get Pro" Sections
348 *
349 * @param object $self
350 * @param array $labels
351 */
352 public static function register_pro_sections( $self, $labels = [] ) {
353 foreach ( $labels as $label ) {
354 self::register_pro_section( $self, $label );
355 }
356 }
357
358 /**
359 * Register normal and hover styles.
360 *
361 * @param object $self
362 * @param string $label
363 * @param array $args
364 */
365 public static function register_style_section( $self, $label = '', $selector = '', $args = [] ) {
366 $id = 'reusable-' . sanitize_title_with_dashes( $label );
367
368 $size = isset( $args[ 'size' ] ) ? $args[ 'size' ] : false;
369 $text_decoration = isset( $args[ 'text_decoration' ] ) ? $args[ 'text_decoration' ] : false;
370 $margin = isset( $args[ 'margin' ] ) ? $args[ 'margin' ] : true;
371 $padding = isset( $args[ 'padding' ] ) ? $args[ 'padding' ] : true;
372 $border = isset( $args[ 'border' ] ) ? $args[ 'border' ] : false; // Disabled.
373 $border_radius = isset( $args[ 'border_radius' ] ) ? $args[ 'border_radius' ] : true;
374 $background = isset( $args[ 'background' ] ) ? $args[ 'background' ] : false; // Disabled.
375 $text_color = isset( $args[ 'text_color' ] ) ? $args[ 'text_color' ] : false; // Disabled.
376 $typography = isset( $args[ 'typography' ] ) ? $args[ 'typography' ] : true;
377 $text_align = isset( $args[ 'text_align' ] ) ? $args[ 'text_align' ] : true;
378 $box_shadow = isset( $args[ 'box_shadow' ] ) ? $args[ 'box_shadow' ] : false; // Disabled.
379 $tabs = isset( $args[ 'tabs' ] ) ? $args[ 'tabs' ] : true;
380 $normal_background = isset( $args[ 'normal_background' ] ) ? $args[ 'normal_background' ] : true;
381 $normal_text_color = isset( $args[ 'normal_text_color' ] ) ? $args[ 'normal_text_color' ] : true;
382 $normal_typography = isset( $args[ 'normal_typography' ] ) ? $args[ 'normal_typography' ] : false; // Disabled.
383 $normal_border = isset( $args[ 'normal_border' ] ) ? $args[ 'normal_border' ] : true;
384 $normal_box_shadow = isset( $args[ 'normal_box_shadow' ] ) ? $args[ 'normal_box_shadow' ] : true;
385
386 // Section.
387 $self->start_controls_section(
388 $id . '_style_section',
389 [
390 'label' => $label,
391 'tab' => Controls_Manager::TAB_STYLE,
392 ]
393 );
394
395 if ( $margin ) :
396 $self->add_responsive_control(
397 $id . '_margin',
398 array(
399 'label' => esc_html__( 'Margin', 'copy-the-code' ),
400 'type' => Controls_Manager::DIMENSIONS,
401 'size_units' => array( 'px', 'em', '%' ),
402 'selectors' => array(
403 '{{WRAPPER}} ' . $selector => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
404 ),
405 )
406 );
407 endif;
408
409 if ( $padding ) :
410 $self->add_responsive_control(
411 $id . '_padding',
412 array(
413 'label' => esc_html__( 'Padding', 'copy-the-code' ),
414 'type' => Controls_Manager::DIMENSIONS,
415 'size_units' => array( 'px', 'em', '%' ),
416 'selectors' => array(
417 '{{WRAPPER}} ' . $selector => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
418 ),
419 )
420 );
421 endif;
422
423 if ( $border ) :
424 $border_selector = '{{WRAPPER}} ' . $selector;
425 if ( isset( $args[ 'border' ] ) && is_array( $args[ 'border' ] ) ) {
426 if ( isset( $args[ 'border' ][ 'selector' ] ) ) {
427 $border_selector = $args[ 'border' ][ 'selector' ];
428 }
429 }
430 $self->add_group_control(
431 \Elementor\Group_Control_Border::get_type(),
432 [
433 'name' => $id . '_border',
434 'selector' => $border_selector,
435 ]
436 );
437 endif;
438
439 if ( $border_radius ) :
440 $self->add_responsive_control(
441 $id . '_border_radius',
442 array(
443 'label' => esc_html__( 'Border Radius', 'copy-the-code' ),
444 'type' => Controls_Manager::DIMENSIONS,
445 'size_units' => array( 'px', '%' ),
446 'selectors' => array(
447 '{{WRAPPER}} ' . $selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
448 ),
449 )
450 );
451 endif;
452
453 if ( $background ) :
454 $self->add_group_control(
455 \Elementor\Group_Control_Background::get_type(),
456 [
457 'name' => $id . '_background',
458 'types' => [ 'classic', 'gradient' ],
459 'exclude' => [ 'image', 'video' ],
460 'selector' => '{{WRAPPER}} ' . $selector,
461 ]
462 );
463 endif;
464
465 if ( $text_color ) :
466 $self->add_control(
467 $id . '_text_color',
468 [
469 'label' => esc_html__( 'Text Color', 'copy-the-code' ),
470 'type' => Controls_Manager::COLOR,
471 'selectors' => [
472 '{{WRAPPER}} ' . $selector => 'color: {{VALUE}};',
473 ],
474 ]
475 );
476 endif;
477
478 if ( $typography ) :
479 $self->add_group_control(
480 \Elementor\Group_Control_Typography::get_type(),
481 [
482 'name' => $id . '_typography',
483 'selector' => '{{WRAPPER}} ' . $selector,
484 ]
485 );
486 endif;
487
488 if ( $size ) :
489 $size_label = esc_html__( 'Width', 'copy-the-code' );
490 $size_selectors = [
491 '{{WRAPPER}} ' . $selector => 'width: {{SIZE}}{{UNIT}};',
492 ];
493 if ( isset( $args[ 'size' ] ) && is_array( $args[ 'size' ] ) ) {
494 if ( isset( $args[ 'size' ][ 'selectors' ] ) ) {
495 $size_selectors = $args[ 'size' ][ 'selectors' ];
496 }
497 if ( isset( $args[ 'size' ][ 'label' ] ) ) {
498 $size_label = $args[ 'size' ][ 'label' ];
499 }
500 }
501
502 $self->add_responsive_control(
503 $id . '_size',
504 [
505 'label' => $size_label,
506 'type' => Controls_Manager::SLIDER,
507 'size_units' => [ 'px', 'em', '%' ],
508 'selectors' => $size_selectors,
509 ]
510 );
511 endif;
512
513 if ( $text_decoration ) :
514 $text_decoration_selectors = [
515 '{{WRAPPER}} ' . $selector => 'text-decoration: {{VALUE}};',
516 ];
517 if ( isset( $args[ 'text_decoration' ] ) && is_array( $args[ 'text_decoration' ] ) ) {
518 if ( isset( $args[ 'text_decoration' ][ 'selectors' ] ) ) {
519 $text_decoration_selectors = $args[ 'text_decoration' ][ 'selectors' ];
520 }
521 }
522
523 $self->add_control(
524 $id . '_text_decoration',
525 [
526 'label' => esc_html__( 'Text Decoration', 'copy-the-code' ),
527 'type' => Controls_Manager::SELECT,
528 'options' => [
529 'none' => esc_html__( 'None', 'copy-the-code' ),
530 'underline' => esc_html__( 'Underline', 'copy-the-code' ),
531 'overline' => esc_html__( 'Overline', 'copy-the-code' ),
532 'line-through' => esc_html__( 'Line Through', 'copy-the-code' ),
533 ],
534 'selectors' => $text_decoration_selectors,
535 ]
536 );
537 endif;
538
539 if ( $text_align ) :
540 $self->add_responsive_control(
541 $id . '_text_align',
542 [
543 'label' => esc_html__( 'Alignment', 'copy-the-code' ),
544 'type' => Controls_Manager::CHOOSE,
545 'options' => [
546 'left' => [
547 'title' => esc_html__( 'Left', 'copy-the-code' ),
548 'icon' => 'eicon-text-align-left',
549 ],
550 'center' => [
551 'title' => esc_html__( 'Center', 'copy-the-code' ),
552 'icon' => 'eicon-text-align-center',
553 ],
554 'right' => [
555 'title' => esc_html__( 'Right', 'copy-the-code' ),
556 'icon' => 'eicon-text-align-right',
557 ],
558 ],
559 'selectors' => [
560 '{{WRAPPER}} ' . $selector => 'text-align: {{VALUE}};',
561 ],
562 ]
563 );
564 endif;
565
566 if ( $box_shadow ) :
567 $self->add_group_control(
568 \Elementor\Group_Control_Box_Shadow::get_type(),
569 [
570 'name' => $id . '_box_shadow',
571 'selector' => '{{WRAPPER}} ' . $selector,
572 ]
573 );
574 endif;
575
576 if ( $tabs ) :
577 // Tabs.
578 $self->start_controls_tabs(
579 $id . '_style_tabs'
580 );
581
582 // Normal.
583 $self->start_controls_tab(
584 $id . '_style_normal_tab',
585 [
586 'label' => esc_html__( 'Normal', 'copy-the-code' ),
587 ]
588 );
589
590 if ( $normal_background ) :
591 $self->add_group_control(
592 \Elementor\Group_Control_Background::get_type(),
593 [
594 'name' => $id . '_normal_background',
595 'types' => [ 'classic', 'gradient' ],
596 'exclude' => [ 'image', 'video' ],
597 'selector' => '{{WRAPPER}} ' . $selector,
598 ]
599 );
600 endif;
601
602 if ( $normal_text_color ) :
603 $normal_text_color_label = esc_html__( 'Text Color', 'copy-the-code' );
604 $normal_text_color_selectors = [
605 '{{WRAPPER}} ' . $selector => 'color: {{VALUE}};',
606 ];
607 if ( isset( $args[ 'normal_text_color' ] ) && is_array( $args[ 'normal_text_color' ] ) ) {
608 if ( isset( $args[ 'normal_text_color' ][ 'selectors' ] ) ) {
609 $normal_text_color_selectors = $args[ 'normal_text_color' ][ 'selectors' ];
610 }
611 if ( isset( $args[ 'normal_text_color' ][ 'label' ] ) ) {
612 $normal_text_color_label = $args[ 'normal_text_color' ][ 'label' ];
613 }
614 }
615 $self->add_control(
616 $id . '_normal_text_color',
617 [
618 'label' => $normal_text_color_label,
619 'type' => Controls_Manager::COLOR,
620 'selectors' => $normal_text_color_selectors,
621 ]
622 );
623 endif;
624
625 if ( $normal_typography ) :
626 $self->add_group_control(
627 \Elementor\Group_Control_Typography::get_type(),
628 [
629 'name' => $id . '_normal_typography',
630 'selector' => '{{WRAPPER}} ' . $selector,
631 ]
632 );
633 endif;
634
635 if ( $normal_border ) :
636 $self->add_group_control(
637 \Elementor\Group_Control_Border::get_type(),
638 [
639 'name' => $id . '_normal_border',
640 'default' => 'red',
641 'selector' => '{{WRAPPER}} ' . $selector,
642 ]
643 );
644 endif;
645
646 if ( $normal_box_shadow ) :
647 $self->add_group_control(
648 \Elementor\Group_Control_Box_Shadow::get_type(),
649 [
650 'name' => $id . '_normal_box_shadow',
651 'selector' => '{{WRAPPER}} ' . $selector,
652 ]
653 );
654 endif;
655
656 $self->end_controls_tab();
657 // Normal End.
658
659 // Hover.
660 $self->start_controls_tab(
661 $id . '_style_hover_tab',
662 [
663 'label' => esc_html__( 'Hover', 'copy-the-code' ),
664 ]
665 );
666
667 if ( $normal_background ) :
668 $self->add_group_control(
669 \Elementor\Group_Control_Background::get_type(),
670 [
671 'name' => $id . '_hover_background',
672 'types' => [ 'classic', 'gradient' ],
673 'exclude' => [ 'image' ],
674 'selector' => '{{WRAPPER}} ' . $selector . ':hover',
675 ]
676 );
677 endif;
678
679 if ( $normal_text_color ) :
680
681 $hover_text_color_label = esc_html__( 'Text Color', 'copy-the-code' );
682 $hover_text_color_selectors = [
683 '{{WRAPPER}} ' . $selector => 'color: {{VALUE}};',
684 ];
685 if ( isset( $args[ 'hover_text_color' ] ) && is_array( $args[ 'hover_text_color' ] ) ) {
686 if ( isset( $args[ 'hover_text_color' ][ 'selectors' ] ) ) {
687 $hover_text_color_selectors = $args[ 'hover_text_color' ][ 'selectors' ];
688 }
689 if ( isset( $args[ 'hover_text_color' ][ 'label' ] ) ) {
690 $hover_text_color_label = $args[ 'hover_text_color' ][ 'label' ];
691 }
692 }
693
694 $self->add_control(
695 $id . '_hover_text_color',
696 array(
697 'label' => $hover_text_color_label,
698 'type' => Controls_Manager::COLOR,
699 'selectors' => $hover_text_color_selectors,
700 )
701 );
702 endif;
703
704 if ( $normal_border ) :
705 $self->add_control(
706 $id . '_hover_border',
707 array(
708 'label' => esc_html__( 'Border Color', 'copy-the-code' ),
709 'type' => Controls_Manager::COLOR,
710 'selectors' => array(
711 '{{WRAPPER}} ' . $selector . ':hover' => 'border-color: {{VALUE}};',
712 ),
713 )
714 );
715 endif;
716
717 if ( $normal_box_shadow ) :
718 $self->add_group_control(
719 \Elementor\Group_Control_Box_Shadow::get_type(),
720 array(
721 'name' => $id . '_hover_box_shadow',
722 'selector' => '{{WRAPPER}} ' . $selector . ':hover',
723 )
724 );
725 endif;
726
727 $self->end_controls_tab();
728 // Hover End.
729
730 $self->end_controls_tabs();
731 // Tabs.
732 endif;
733
734 $self->end_controls_section();
735 // Section End.
736 }
737
738 }