Current File : /home/n742ef5/royalanteam.com/wp-content/plugins/myhome-core/src/Widgets/User/UserBoxWidget.php |
<?php
namespace Tangibledesign\MyHome\Widgets\User;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Repeater;
use Tangibledesign\Framework\Core\Collection;
use Tangibledesign\Framework\Interfaces\HasReviewsInterface;
use Tangibledesign\Framework\Models\Image;
use Tangibledesign\Framework\Widgets\Helpers\BaseUserWidget;
use Tangibledesign\Framework\Widgets\Helpers\UserOnlineCheckTrait;
use Tangibledesign\MyHome\Traits\Widgets\RatingContentControlsTrait;
use Tangibledesign\MyHome\Widgets\Helpers\SocialIconStyleSectionTrait;
class UserBoxWidget extends BaseUserWidget
{
use RatingContentControlsTrait;
use UserOnlineCheckTrait;
use SocialIconStyleSectionTrait;
public function getKey(): string
{
return 'user_box';
}
public function getName(): string
{
return esc_html__('User Box', 'myhome-core');
}
protected function register_controls(): void
{
$this->addContentSection();
$this->addRatingContentSection();
$this->addGeneralStyleSection();
$this->addSocialIconsStyleSection();
$this->addContactButtonsStyleSection();
$this->addAvatarStyleSection();
$this->addUserNameStyleSection();
$this->addJobTitleStyleSection();
$this->addUserStateStyleSection();
$this->addRatingStyleSection();
$this->addAccountTypeStyleSection();
$this->addAddressStyleSection();
$this->addVisibilitySection();
}
private function addContentSection(): void
{
$this->startContentControlsSection();
$this->addElementsControl();
$this->addContactButtonsControl();
$this->endControlsSection();
}
public function getReviewSubject(): ?HasReviewsInterface
{
$user = $this->getUser();
return $user instanceof HasReviewsInterface ? $user : null;
}
public function getImage(): ?Image
{
$user = $this->getUser();
if (!$user) {
return null;
}
$image = $user->getImage();
if (!$image) {
return null;
}
return $image;
}
private function addContactButtonsControl(): void
{
$buttons = new Repeater();
$buttons->add_control(
'type',
[
'label' => esc_html__('Type', 'myhome-core'),
'type' => Controls_Manager::SELECT,
'options' => [
'email' => esc_html__('Email', 'myhome-core'),
'phone' => esc_html__('Phone', 'myhome-core'),
'whatsapp' => esc_html__('WhatsApp', 'myhome-core'),
'viber' => esc_html__('Viber', 'myhome-core'),
],
'default' => 'phone',
]
);
$buttons->add_control(
'label',
[
'label' => esc_html__('Label', 'myhome-core'),
'type' => Controls_Manager::TEXT,
]
);
$buttons->add_control(
'icon',
[
'label' => esc_html__('Icon', 'myhome-core'),
'type' => Controls_Manager::ICONS,
]
);
$buttons->add_control(
'button_type',
[
'label' => esc_html__('Button Type', 'myhome-core'),
'type' => Controls_Manager::SELECT,
'options' => [
'primary' => esc_html__('Primary', 'myhome-core'),
'secondary' => esc_html__('Secondary', 'myhome-core'),
],
'default' => 'primary',
]
);
$this->add_control(
'contact_buttons',
[
'label' => esc_html__('Contact buttons', 'myhome-core'),
'type' => Controls_Manager::REPEATER,
'fields' => $buttons->get_controls(),
'default' => [
[
'type' => 'phone',
],
[
'type' => 'whatsapp',
],
],
]
);
}
public function getContactButtons(): Collection
{
$buttons = $this->get_settings_for_display('contact_buttons');
if (empty($buttons) || !is_array($buttons)) {
return tdf_collect();
}
return tdf_collect($buttons);
}
private function addElementsControl(): void
{
$elements = new Repeater();
$elements->add_control(
'type',
[
'label' => esc_html__('Type', 'myhome-core'),
'type' => Controls_Manager::SELECT,
'options' => [
'name' => esc_html__('Name', 'myhome-core'),
'job_title' => esc_html__('Job Title', 'myhome-core'),
'rating' => esc_html__('Rating', 'myhome-core'),
'account_type' => esc_html__('Account Type', 'myhome-core'),
'state' => esc_html__('State', 'myhome-core'),
'address' => esc_html__('Address', 'myhome-core'),
],
]
);
$elements->add_control(
'text_before',
[
'label' => esc_html__('Text Before', 'myhome-core'),
'type' => Controls_Manager::TEXT,
'condition' => [
'type' => [
'job_title',
'account_type',
],
]
]
);
$elements->add_control(
'text_after',
[
'label' => esc_html__('Text After', 'myhome-core'),
'type' => Controls_Manager::TEXT,
'condition' => [
'type' => [
'job_title',
'account_type',
],
]
]
);
$elements->add_control(
'user_online_text',
[
'label' => esc_html__('User Online Text', 'myhome-core'),
'type' => Controls_Manager::TEXT,
'placeholder' => tdf_string('user_is_online_now'),
'condition' => [
'type' => 'state',
],
]
);
$elements->add_control(
'user_offline_text',
[
'label' => esc_html__('User Offline Text', 'myhome-core'),
'type' => Controls_Manager::TEXT,
'placeholder' => tdf_string('user_is_offline'),
'condition' => [
'type' => 'state',
],
]
);
$elements->add_control(
'user_online_minutes',
[
'label' => esc_html__('Online when active in the last X minutes', 'myhome-core'),
'type' => Controls_Manager::NUMBER,
'description' => esc_html__('Consider a user online when active in the last X minutes.', 'myhome-core'),
'default' => '5',
'condition' => [
'type' => 'state',
'show_user_state' => '1',
],
]
);
$elements->add_control(
'show_see_reviews_link',
[
'label' => esc_html__('Show See Reviews Link', 'myhome-core'),
'type' => Controls_Manager::SWITCHER,
'return_value' => '1',
'default' => '1',
'condition' => [
'type' => 'rating',
],
]
);
$this->add_control(
'elements',
[
'label' => esc_html__('User Box Elements', 'myhome-core'),
'type' => Controls_Manager::REPEATER,
'fields' => $elements->get_controls(),
'default' => [
[
'type' => 'job_title',
],
[
'type' => 'name',
],
[
'type' => 'rating',
],
],
]
);
}
public function getElements(): Collection
{
$elements = $this->get_settings_for_display('elements');
if (empty($elements) || !is_array($elements)) {
return tdf_collect();
}
return tdf_collect($elements);
}
private function addGeneralStyleSection(): void
{
$this->startStyleControlsSection();
$this->add_responsive_control(
'elements_gap',
[
'label' => esc_html__('User Elements Gap', 'myhome-core'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .myhome-user-box__data' => 'gap: {{SIZE}}{{UNIT}};',
],
]
);
$this->endControlsSection();
}
private function addUserStateStyleSection(): void
{
$this->startStyleControlsSection('user_state', esc_html__('User State', 'myhome-core'));
$this->add_responsive_control(
'user_state_margin',
[
'label' => esc_html__('Margin', 'myhome-core'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .myhome-user-box__state' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'user_state_dot_heading',
[
'label' => esc_html__('Dot', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_responsive_control(
'user_state_dot_size',
[
'label' => esc_html__('Size', 'myhome-core'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .myhome-user-box__state:before' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'user_state_dot_space',
[
'label' => esc_html__('Space', 'myhome-core'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .myhome-user-box__state:before' => 'margin-right: {{SIZE}}{{UNIT}};',
],
]
);
$this->start_controls_tabs('user_state_style');
$this->start_controls_tab('online', ['label' => esc_html__('Online', 'myhome-core')]);
$this->add_control(
'user_state_online_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-user-box__state--online' => 'color: {{VALUE}}',
'{{WRAPPER}} .myhome-user-box__state--online:before' => 'background-color: {{VALUE}}'
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'user_state_online_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-user-box__state--online',
]
);
$this->end_controls_tab();
$this->start_controls_tab('offline', ['label' => esc_html__('Offline', 'myhome-core')]);
$this->add_control(
'user_state_offline_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-user-box__state--offline' => 'color: {{VALUE}}',
'{{WRAPPER}} .myhome-user-box__state--offline:before' => 'background-color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'user_state_offline_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-user-box__state--offline',
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->endControlsSection();
}
private function addRatingStyleSection(): void
{
$this->startStyleControlsSection('rating_style', esc_html__('Rating', 'myhome-core'));
$this->add_control(
'rating_heading',
[
'label' => esc_html__('Rating', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'rating_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-rating__rating' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'rating_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-rating__rating',
]
);
$this->add_control(
'rating_count_heading',
[
'label' => esc_html__('Rating Count', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'rating_count_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-contact-user-box__rating-count' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'rating_count_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-contact-user-box__rating-count',
]
);
$this->add_control(
'rating_stars_heading',
[
'label' => esc_html__('Stars', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_responsive_control(
'rating_stars_gap',
[
'label' => esc_html__('Gap', 'myhome-core'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 20,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .myhome-rating__stars' => 'gap: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'rating_star_heading',
[
'label' => esc_html__('Star', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->start_controls_tabs('rating_star_style');
$this->start_controls_tab('empty_star', ['label' => esc_html__('Empty', 'myhome-core')]);
$this->add_control(
'rating_star_empty_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-rating__star:not(.myhome-rating__star--active) path' => 'fill: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab('full_star', ['label' => esc_html__('Full', 'myhome-core')]);
$this->add_control(
'rating_star_full_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-rating__star--active path' => 'fill: {{VALUE}};',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->add_control(
'see_reviews_link_heading',
[
'label' => esc_html__('See Reviews Link', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->start_controls_tabs('see_reviews_link_style');
$this->start_controls_tab('see_reviews_link_normal', ['label' => esc_html__('Normal', 'myhome-core')]);
$this->add_control(
'see_reviews_link_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-rating__reviews-link' => 'color: {{VALUE}}',
'{{WRAPPER}} .myhome-rating__reviews-link:before' => 'background-color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'see_reviews_link_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-rating__reviews-link',
]
);
$this->end_controls_tab();
$this->start_controls_tab('see_reviews_link_hover', ['label' => esc_html__('Hover', 'myhome-core')]);
$this->add_control(
'see_reviews_link_hover_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-rating__reviews-link:hover' => 'color: {{VALUE}}',
'{{WRAPPER}} .myhome-rating__reviews-link:hover:before' => 'background-color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'see_reviews_link_hover_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-rating__reviews-link:hover',
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->endControlsSection();
}
private function addAvatarStyleSection(): void
{
$this->startStyleControlsSection('avatar', esc_html__('Avatar', 'myhome-core'));
$this->add_responsive_control(
'avatar_size',
[
'label' => esc_html__('Size', 'myhome-core'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .myhome-user-box__avatar' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .myhome-user-box__avatar img' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'avatar_border_radius',
[
'label' => esc_html__('Border Radius', 'myhome-core'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .myhome-user-box__avatar' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'avatar_margin',
[
'label' => esc_html__('Margin', 'myhome-core'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .myhome-user-box__avatar' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->endControlsSection();
}
private function addUserNameStyleSection(): void
{
$this->startStyleControlsSection('user_name', esc_html__('User Name', 'myhome-core'));
$this->add_control(
'user_name_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-user-box__name' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'user_name_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-user-box__name',
]
);
$this->add_responsive_control(
'user_name_margin',
[
'label' => esc_html__('Margin', 'myhome-core'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .myhome-user-box__name' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->endControlsSection();
}
private function addAccountTypeStyleSection(): void
{
$this->startStyleControlsSection('account_type', esc_html__('Account Type', 'myhome-core'));
$this->add_responsive_control(
'account_type_margin',
[
'label' => esc_html__('Margin', 'myhome-core'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .myhome-user-box__account-type' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'account_type_text_before_heading',
[
'label' => esc_html__('Text Before', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'account_type_text_before_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-user-box__account-type-text-before' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'account_type_text_before_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-user-box__account-type-text-before',
]
);
$this->add_control(
'account_type_text_after_heading',
[
'label' => esc_html__('Text After', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'account_type_text_after_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-user-box__account-type-text-after' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'account_type_text_after_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-user-box__account-type-text-after',
]
);
$this->add_control(
'account_type_value_heading',
[
'label' => esc_html__('Value', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'account_type_value_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-user-box__account-type-value' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'account_type_value_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-user-box__account-type-value',
]
);
$this->endControlsSection();
}
private function addJobTitleStyleSection(): void
{
$this->startStyleControlsSection('job_title_style', esc_html__('Job Title', 'myhome-core'));
$this->add_responsive_control(
'job_title_margin',
[
'label' => esc_html__('Margin', 'myhome-core'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .myhome-user-box__job-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'job_title_text_before_heading',
[
'label' => esc_html__('Text Before', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'job_title_text_before_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-user-box__job-title-text-before' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'job_title_text_before_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-user-box__job-title-text-before',
]
);
$this->add_control(
'job_title_text_after_heading',
[
'label' => esc_html__('Text After', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'job_title_text_after_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-user-box__job-title-text-after' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'job_title_text_after_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-user-box__job-title-text-after',
]
);
$this->add_control(
'job_title_value_heading',
[
'label' => esc_html__('Value', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'job_title_value_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-user-box__job-title-value' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'job_title_value_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-user-box__job-title-value',
]
);
$this->endControlsSection();
}
private function addContactButtonsStyleSection(): void
{
$this->startStyleControlsSection('contact_buttons_style', esc_html__('Contact Buttons', 'myhome-core'));
$this->add_responsive_control(
'contact_buttons_gap',
[
'label' => esc_html__('Buttons Gap', 'myhome-core'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .myhome-user-box__contact-buttons' => 'gap: {{SIZE}}{{UNIT}};',
],
]
);
$this->endControlsSection();
}
private function addAddressStyleSection(): void
{
$this->startStyleControlsSection('address_style', esc_html__('Address', 'myhome-core'));
$this->add_responsive_control(
'address_margin',
[
'label' => esc_html__('Margin', 'myhome-core'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .myhome-user-box__address' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'address_heading',
[
'label' => esc_html__('Icon', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'address_icon_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-user-box__address-icon i' => 'color: {{VALUE}}',
'{{WRAPPER}} .myhome-user-box__address-icon path' => 'fill: {{VALUE}}',
],
]
);
$this->add_responsive_control(
'address_icon_size',
[
'label' => esc_html__('Size', 'myhome-core'),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .myhome-user-box__address-icon i' => 'font-size: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .myhome-user-box__address-icon svg' => 'height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'address_style_heading',
[
'label' => esc_html__('Address', 'myhome-core'),
'type' => Controls_Manager::HEADING,
]
);
$this->add_control(
'address_color',
[
'label' => esc_html__('Color', 'myhome-core'),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .myhome-user-box__address' => 'color: {{VALUE}}',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'address_typography',
'label' => esc_html__('Typography', 'myhome-core'),
'selector' => '{{WRAPPER}} .myhome-user-box__address',
]
);
$this->endControlsSection();
}
}