# copy-the-code/5.5.4/includes/elementor/widgets/copy-icon/widget.php

Copy Anything to Clipboard for WordPress – Copy Button, Copy Text &amp; Copy Code, version 5.5.4. 138 lines.

- Page: https://pluginprobe.com/plugins/copy-the-code/5.5.4/code/includes/elementor/widgets/copy-icon/widget.php
- Raw: https://pluginprobe.com/plugins/copy-the-code/5.5.4/raw/includes/elementor/widgets/copy-icon/widget.php
- Modified: 2026-10-09T07:14:22+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/copy-the-code/5.5.4/code/includes/elementor/widgets/copy-icon/widget.php#L10-L20`.

```php
<?php
/**
 * Elementor Copy Icon Block
 *
 * @package CTC
 * @since 5.0.0
 */

namespace CTC\Elementor\Block;

use CTC\Helpers;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;

/**
 * Copy Icon Block
 *
 * @since 5.0.0
 */
class CopyIcon extends Widget_Base {

	/**
	 * Constructor
	 */
	public function __construct( $data = [], $args = null ) {
		parent::__construct( $data, $args );

		// Register assets; Elementor enqueues via get_*_depends() when used.
		wp_register_script( 'ctc-lib-core', CTC_URI . 'assets/frontend/js/lib/ctc.js', [ 'jquery' ], CTC_VER, true );
		wp_register_script( 'ctc-blocks-core', CTC_URI . 'includes/assets/js/core.js', [ 'ctc-lib-core' ], CTC_VER, true );
		wp_register_style( 'ctc-el-copy-icon', CTC_URI . 'includes/elementor/widgets/copy-icon/style.css', [], CTC_VER );
	}

	/**
	 * Get script dependencies
	 */
	public function get_script_depends() {
		return [ 'ctc-lib-core', 'ctc-blocks-core' ];
	}

	/**
	 * Get style dependencies
	 */
	public function get_style_depends() {
		return [ 'ctc-el-copy-icon' ];
	}

	/**
	 * Get name
	 */
	public function get_name() {
		return 'ctc_copy_icon';
	}

	/**
	 * Get title
	 */
	public function get_title() {
		return esc_html__( 'Copy to Clipboard Icon', 'ctc' );
	}

	/**
	 * Get icon
	 */
	public function get_icon() {
		return 'eicon-favorite';
	}

	/**
	 * Get categories
	 */
	public function get_categories() {
		return Helpers::get_categories();
	}

	/**
	 * Get keywords
	 */
	public function get_keywords() {
		return Helpers::get_keywords( [ 'icon' ] );
	}

	/**
	 * Render block
	 */
	public function render() {
		?>
		<span class="ctc-block ctc-copy-icon">
			<span copy-as-raw="yes" class="ctc-block-copy ctc-block-copy-icon" role="button" aria-label="Copied">
				<?php echo Helpers::get_svg_copy_icon(); ?>
				<?php echo Helpers::get_svg_checked_icon(); ?>
			</span>
			<?php Helpers::render_copy_content( $this ); ?>
		</span>
		<?php
	}

	/**
	 * Register block controls
	 */
	protected function _register_controls() {
		Helpers::register_copy_content_section( $this );

		Helpers::register_style_section(
			$this,
			'Icon',
			'.ctc-copy-icon svg',
			[
				'padding'           => false,
				'border_radius'     => false,
				'typography'        => false,
				'text_align'        => false,
				'normal_background' => false,
				'normal_box_shadow' => false,
				'normal_border'     => false,
				'normal_text_color' => [
					'label'     => esc_html__( 'Fill Color', 'ctc' ),
					'selectors' => [
						'{{WRAPPER}} .ctc-copy-icon svg' => 'fill: {{VALUE}};',
					],
				],
				'hover_text_color'  => [
					'label'     => esc_html__( 'Fill Color', 'ctc' ),
					'selectors' => [
						'{{WRAPPER}} .ctc-copy-icon svg:hover' => 'fill: {{VALUE}};',
					],
				],
				'size'              => [
					'label'     => esc_html__( 'Icon Size', 'ctc' ),
					'selectors' => [
						'{{WRAPPER}} .ctc-copy-icon svg' => 'font-size: {{SIZE}}{{UNIT}};',
					],
				],
			]
		);
	}
}

```
