PluginProbe
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code / 5.5.4
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code v5.5.4
5.5.4 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 All 79 releases
copy-the-code / includes / elementor / widgets / copy-icon / widget.php

widget.php in Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code 5.5.4, at includes/elementor/widgets/copy-icon/widget.php

138 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Elementor Copy Icon Block
4 *
5 * @package CTC
6 * @since 5.0.0
7 */
8
9 namespace CTC\Elementor\Block;
10
11 use CTC\Helpers;
12 use Elementor\Widget_Base;
13 use Elementor\Controls_Manager;
14
15 /**
16 * Copy Icon Block
17 *
18 * @since 5.0.0
19 */
20 class CopyIcon extends Widget_Base {
21
22 /**
23 * Constructor
24 */
25 public function __construct( $data = [], $args = null ) {
26 parent::__construct( $data, $args );
27
28 // Register assets; Elementor enqueues via get_*_depends() when used.
29 wp_register_script( 'ctc-lib-core', CTC_URI . 'assets/frontend/js/lib/ctc.js', [ 'jquery' ], CTC_VER, true );
30 wp_register_script( 'ctc-blocks-core', CTC_URI . 'includes/assets/js/core.js', [ 'ctc-lib-core' ], CTC_VER, true );
31 wp_register_style( 'ctc-el-copy-icon', CTC_URI . 'includes/elementor/widgets/copy-icon/style.css', [], CTC_VER );
32 }
33
34 /**
35 * Get script dependencies
36 */
37 public function get_script_depends() {
38 return [ 'ctc-lib-core', 'ctc-blocks-core' ];
39 }
40
41 /**
42 * Get style dependencies
43 */
44 public function get_style_depends() {
45 return [ 'ctc-el-copy-icon' ];
46 }
47
48 /**
49 * Get name
50 */
51 public function get_name() {
52 return 'ctc_copy_icon';
53 }
54
55 /**
56 * Get title
57 */
58 public function get_title() {
59 return esc_html__( 'Copy to Clipboard Icon', 'ctc' );
60 }
61
62 /**
63 * Get icon
64 */
65 public function get_icon() {
66 return 'eicon-favorite';
67 }
68
69 /**
70 * Get categories
71 */
72 public function get_categories() {
73 return Helpers::get_categories();
74 }
75
76 /**
77 * Get keywords
78 */
79 public function get_keywords() {
80 return Helpers::get_keywords( [ 'icon' ] );
81 }
82
83 /**
84 * Render block
85 */
86 public function render() {
87 ?>
88 <span class="ctc-block ctc-copy-icon">
89 <span copy-as-raw="yes" class="ctc-block-copy ctc-block-copy-icon" role="button" aria-label="Copied">
90 <?php echo Helpers::get_svg_copy_icon(); ?>
91 <?php echo Helpers::get_svg_checked_icon(); ?>
92 </span>
93 <?php Helpers::render_copy_content( $this ); ?>
94 </span>
95 <?php
96 }
97
98 /**
99 * Register block controls
100 */
101 protected function _register_controls() {
102 Helpers::register_copy_content_section( $this );
103
104 Helpers::register_style_section(
105 $this,
106 'Icon',
107 '.ctc-copy-icon svg',
108 [
109 'padding' => false,
110 'border_radius' => false,
111 'typography' => false,
112 'text_align' => false,
113 'normal_background' => false,
114 'normal_box_shadow' => false,
115 'normal_border' => false,
116 'normal_text_color' => [
117 'label' => esc_html__( 'Fill Color', 'ctc' ),
118 'selectors' => [
119 '{{WRAPPER}} .ctc-copy-icon svg' => 'fill: {{VALUE}};',
120 ],
121 ],
122 'hover_text_color' => [
123 'label' => esc_html__( 'Fill Color', 'ctc' ),
124 'selectors' => [
125 '{{WRAPPER}} .ctc-copy-icon svg:hover' => 'fill: {{VALUE}};',
126 ],
127 ],
128 'size' => [
129 'label' => esc_html__( 'Icon Size', 'ctc' ),
130 'selectors' => [
131 '{{WRAPPER}} .ctc-copy-icon svg' => 'font-size: {{SIZE}}{{UNIT}};',
132 ],
133 ],
134 ]
135 );
136 }
137 }
138