Current File : /home/n742ef5/royalanteam.com/wp-content/plugins/myhome-core/src/Widgets/User/UserImageWidget.php
<?php

namespace Tangibledesign\MyHome\Widgets\User;


use Elementor\Controls_Manager;
use Tangibledesign\Framework\Widgets\Helpers\BaseUserWidget;
use Tangibledesign\Framework\Widgets\Helpers\Controls\BorderRadiusControl;
use Tangibledesign\Framework\Widgets\Helpers\Controls\ImageSizeControl;

class UserImageWidget extends BaseUserWidget
{
    use ImageSizeControl;
    use BorderRadiusControl;

    public function getKey(): string
    {
        return 'user_image';
    }

    public function getName(): string
    {
        return esc_html__('User Image', 'myhome-core');
    }

    protected function register_controls(): void
    {
        $this->startStyleControlsSection();

        $this->addImageWidthControl();

        $this->addImageSizeControl();

        $this->addBorderRadiusControl('.myhome-user-image-widget');

        $this->endControlsSection();

        $this->addVisibilitySection();
    }

    protected function addImageWidthControl(): void
    {
        $this->add_responsive_control(
            'width',
            [
                'label' => esc_html__('Size', 'myhome-core'),
                'type' => Controls_Manager::SLIDER,
                'size_units' => ['px'],
                'range' => [
                    'px' => [
                        'min' => 0,
                        'max' => 1000,
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}} .myhome-user-image-widget' => 'width: {{SIZE}}{{UNIT}}!important; height: {{SIZE}}{{UNIT}}!important;'
                ]
            ]
        );
    }
}