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

namespace Tangibledesign\MyHome\Widgets\General;

use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Tangibledesign\Framework\Widgets\Helpers\SelectRemoteControl;
use Tangibledesign\MyHome\Widgets\Helpers\Controls\ShareIconsStyleSection;

class MenuWidget extends \Tangibledesign\Framework\Widgets\General\MenuWidget
{
    use ShareIconsStyleSection;

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

    protected function getTemplateDirectory(): string
    {
        return 'general/menu/';
    }

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

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

        $this->addMenuControl();

        $this->addLogoControls();

        $this->addMenuStyleControl();

        $this->addMenuHeightControl();

        $this->addLogoHeightControl();

        $this->addMenuStretchControl();

        $this->addMobileBreakpointControl();

        $this->endControlsSection();

        $this->addPrimaryCtaButtonContentSection();

        $this->addSecondaryCtaButtonContentSection();

        $this->addDesktopMenuStyleControls();

        $this->addStickyMenuControls();

        $this->addDesktopMenuItemControls();

        $this->addStickyDesktopMenuItemControls();

        $this->addDesktopSubmenuItemControls();

        $this->addMobileMenuControls();

        $this->addMobileMenuItemControls();
    }

    private function addDesktopMenuStyleControls(): void
    {
        $this->startStyleControlsSection('desktop_menu_style');

        $this->addBackgroundColorControl();

        $this->addBottomBorderControls();

        $this->addHamburgerIconStyleControls();

        $this->endControlsSection();
    }

    private function addBackgroundColorControl(): void
    {
        $this->add_control(
            'background_color',
            [
                'label' => esc_html__('Background color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu' => 'background-color: {{VALUE}};'
                ]
            ]
        );
    }

    private function addBottomBorderControls(): void
    {
        $this->add_control(
            'bottom_border_heading',
            [
                'label' => esc_html__('Bottom Border', 'myhome-core'),
                'type' => Controls_Manager::HEADING,
            ]
        );

        $this->add_control(
            'bottom_border_color',
            [
                'label' => esc_html__('Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__line' => 'background-color: {{VALUE}};'
                ]
            ]
        );

        $this->add_responsive_control(
            'bottom_border_height',
            [
                'label' => esc_html__('Height', 'myhome-core'),
                'type' => Controls_Manager::SLIDER,
                'size_units' => ['px'],
                'range' => [
                    'px' => [
                        'min' => 0,
                        'max' => 10,
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__line' => 'height: {{SIZE}}{{UNIT}};',
                ]
            ]
        );
    }

    public function getMenuStyle(): string
    {
        $style = $this->get_settings_for_display('menu_style');
        if (empty($style)) {
            return 'dark';
        }

        return $style;
    }

    protected function addMenuStyleControl(): void
    {
        $this->add_control(
            'menu_style',
            [
                'label' => esc_html__('Style', 'myhome-core'),
                'type' => Controls_Manager::SELECT,
                'options' => [
                    'light' => esc_html__('Light', 'myhome-core'),
                    'dark' => esc_html__('Dark', 'myhome-core'),
                ],
                'default' => 'dark',
            ]
        );
    }

    protected function addLogoHeightControl(): void
    {
        $this->add_control(
            'logo_height',
            [
                'label' => esc_html__('Logo Height (px)', 'myhome-core'),
                'type' => Controls_Manager::SLIDER,
                'size_units' => ['px'],
                'range' => [
                    'px' => [
                        'min' => 0,
                        'max' => 400,
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__logo' => 'height: {{SIZE}}{{UNIT}};',
                ]
            ]
        );
    }

    protected function addMenuHeightControl(): void
    {
        $this->add_control(
            'menu_height',
            [
                'label' => esc_html__('Menu Height', 'myhome-core'),
                'type' => Controls_Manager::SLIDER,
                'size_units' => ['px'],
                'range' => [
                    'px' => [
                        'min' => 0,
                        'max' => 400,
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu' => 'height: {{SIZE}}{{UNIT}};',
                    '{{WRAPPER}} .myhome-menu .myhome-menu__items > .myhome-menu__item > a ' => 'height: {{SIZE}}{{UNIT}};',
                    '{{WRAPPER}} .myhome-menu .myhome-menu__account' => 'height: {{SIZE}}{{UNIT}};',
                    '.myhome-menu-sticky .myhome-menu-sticky-holder' => 'height: {{SIZE}}{{UNIT}};',
                ]
            ]
        );
    }

    public function getMenuArgs(): array
    {
        return [
            'main_class' => 'myhome-menu__items',
            'template_path' => 'templates/widgets/general/menu/',
            'menu_element_class' => 'myhome-menu__item ',
            'menu_element_depth_classes' => [
                'myhome-menu__item--depth-',
            ],
            'menu_level_class' => 'myhome-menu__submenu',
            'menu_level_depth_classes' => [
                'myhome-menu__submenu--depth-',
            ]
        ];
    }

    public function getMenuMobileArgs(): array
    {
        return [
            'main_class' => 'myhome-menu-mobile__items',
            'template_path' => 'templates/widgets/general/menu/mobile/',
            'menu_element_class' => 'myhome-menu-mobile__item ',
            'menu_element_depth_classes' => [
                'myhome-menu-mobile__item--depth-',
            ],
            'menu_level_class' => 'myhome-menu-mobile__submenu',
            'menu_level_depth_classes' => [
                'myhome-menu-mobile__submenu--depth-',
            ]
        ];
    }

    private function addPrimaryCtaButtonContentSection(): void
    {
        $this->startContentControlsSection(
            'primary_cta_button_content',
            esc_html__('Primary Call to Action Button', 'myhome-core')
        );

        $this->add_control(
            'primary_cta_icon',
            [
                'label' => esc_html__('Icon', 'myhome-core'),
                'type' => Controls_Manager::ICONS,
            ]
        );

        $this->add_control(
            'primary_cta_type',
            [
                'label' => esc_html__('Type', 'myhome-core'),
                'type' => Controls_Manager::SELECT,
                'options' => [
                    'button' => esc_html__('Button', 'myhome-core'),
                    'phone' => esc_html__('Phone', 'myhome-core'),
                    'none' => esc_html__('None', 'myhome-core'),
                ],
                'default' => 'phone',
            ]
        );

        $this->add_control(
            'primary_cta_custom_url_switch',
            [
                'label' => esc_html__('Use Custom URL', 'myhome-core'),
                'type' => Controls_Manager::SWITCHER,
                'default' => '0',
                'return_value' => '1',
                'condition' => [
                    'primary_cta_type' => 'button',
                ],
            ]
        );

        $this->add_control(
            'primary_cta_button_destination',
            [
                'label' => tdf_admin_string('destination'),
                'type' => SelectRemoteControl::TYPE,
                'source' => tdf_action_url(tdf_prefix() . '/button/destinations'),
                'condition' => [
                    'primary_cta_type' => 'button',
                    'primary_cta_custom_url_switch!' => '1',
                ]
            ]
        );

        $this->add_control(
            'primary_cta_button_destination_custom',
            [
                'label' => esc_html__('Custom URL', 'myhome-core'),
                'type' => Controls_Manager::TEXT,
                'condition' => [
                    'primary_cta_type' => 'button',
                    'primary_cta_custom_url_switch' => '1',
                ],
            ]
        );

        $this->add_control(
            'primary_cta_button_text',
            [
                'label' => esc_html__('Text', 'myhome-core'),
                'type' => Controls_Manager::TEXT,
                'default' => esc_html__('Button', 'myhome-core'),
                'condition' => [
                    'primary_cta_type' => 'button',
                ],
            ]
        );

        $this->add_control(
            'primary_cta_phone_number',
            [
                'label' => esc_html__('Phone Number', 'myhome-core'),
                'type' => Controls_Manager::TEXT,
                'condition' => [
                    'primary_cta_type' => 'phone',
                ],
            ]
        );

        $this->endControlsSection();
    }

    public function getPrimaryCtaPhoneNumber(): string
    {
        $text = (string)$this->get_settings_for_display('primary_cta_phone_number');
        if (empty($text)) {
            return tdf_settings()->getPhone();
        }

        return $text;
    }

    public function getPrimaryCtaPhoneNumberUrl(): string
    {
        return apply_filters(
            tdf_prefix() . '/phoneUrl',
            $this->getPrimaryCtaPhoneNumber(),
            null
        );
    }

    public function getPrimaryCtaButtonText(): string
    {
        return (string)$this->get_settings_for_display('primary_cta_button_text');
    }

    public function getPrimaryCtaButtonUrl(): string
    {
        if ($this->get_settings_for_display('primary_cta_custom_url_switch') === '1') {
            return $this->get_settings_for_display('primary_cta_button_destination_custom');
        }

        return apply_filters(
            tdf_prefix() . '/button/destination',
            false,
            (string)$this->get_settings_for_display('primary_cta_button_destination')
        );
    }


    public function getPrimaryCtaButtonType(): string
    {
        return (string)$this->get_settings_for_display('primary_cta_type');
    }

    public function getPrimaryCtaButtonIcon(): array
    {
        return (array)$this->get_settings_for_display('primary_cta_icon');
    }

    public function hasPrimaryCtaButtonIcon(): bool
    {
        $icon = $this->getPrimaryCtaButtonIcon();

        if (isset($icon['library']) && $icon['library'] === 'svg' && !empty($icon['value']['url'])) {
            return true;
        }

        if (!empty($icon['value'])) {
            return true;
        }

        return false;
    }

    private function addSecondaryCtaButtonContentSection(): void
    {
        $this->startContentControlsSection(
            'secondary_cta_button_content',
            esc_html__('Secondary Call to Action Button', 'myhome-core')
        );

        $this->add_control(
            'secondary_cta_icon',
            [
                'label' => esc_html__('Icon', 'myhome-core'),
                'type' => Controls_Manager::ICONS,
            ]
        );

        $this->add_control(
            'secondary_cta_type',
            [
                'label' => esc_html__('Type', 'myhome-core'),
                'type' => Controls_Manager::SELECT,
                'options' => [
                    'button' => esc_html__('Button', 'myhome-core'),
                    'phone' => esc_html__('Phone', 'myhome-core'),
                    'none' => esc_html__('None', 'myhome-core'),
                ],
                'default' => 'phone',
            ]
        );

        $this->add_control(
            'secondary_cta_custom_url_switch',
            [
                'label' => esc_html__('Use Custom URL', 'myhome-core'),
                'type' => Controls_Manager::SWITCHER,
                'default' => '0',
                'return_value' => '1',
                'condition' => [
                    'secondary_cta_type' => 'button',
                ],
            ]
        );

        $this->add_control(
            'secondary_cta_button_destination',
            [
                'label' => tdf_admin_string('destination'),
                'type' => SelectRemoteControl::TYPE,
                'source' => tdf_action_url(tdf_prefix() . '/button/destinations'),
                'condition' => [
                    'secondary_cta_type' => 'button',
                    'secondary_cta_custom_url_switch!' => '1',
                ]
            ]
        );

        $this->add_control(
            'secondary_cta_button_destination_custom',
            [
                'label' => esc_html__('Custom URL', 'myhome-core'),
                'type' => Controls_Manager::TEXT,
                'condition' => [
                    'secondary_cta_type' => 'button',
                    'secondary_cta_custom_url_switch' => '1',
                ],
            ]
        );

        $this->add_control(
            'secondary_cta_button_text',
            [
                'label' => tdf_admin_string('text'),
                'type' => Controls_Manager::TEXT,
                'default' => esc_html__('Button', 'myhome-core'),
                'condition' => [
                    'secondary_cta_type' => 'button',
                ],
            ]
        );

        $this->add_control(
            'secondary_cta_phone_number',
            [
                'label' => esc_html__('Phone Number', 'myhome-core'),
                'type' => Controls_Manager::TEXT,
                'condition' => [
                    'secondary_cta_type' => 'phone',
                ],
            ]
        );

        $this->endControlsSection();
    }

    public function getSecondaryCtaButtonIcon(): array
    {
        return (array)$this->get_settings_for_display('secondary_cta_icon');
    }

    public function hasSecondaryCtaButtonIcon(): bool
    {
        $icon = $this->getSecondaryCtaButtonIcon();

        if (isset($icon['library']) && $icon['library'] === 'svg' && !empty($icon['value']['url'])) {
            return true;
        }

        if (!empty($icon['value'])) {
            return true;
        }

        return false;
    }

    public function getSecondaryCtaPhoneNumber(): string
    {
        $text = (string)$this->get_settings_for_display('secondary_cta_phone_number');
        if (empty($text)) {
            return tdf_settings()->getPhone();
        }

        return $text;
    }

    public function getSecondaryCtaPhoneNumberUrl(): string
    {
        return apply_filters(
            tdf_prefix() . '/phoneUrl',
            $this->getSecondaryCtaPhoneNumber(),
            null
        );
    }

    public function getSecondaryCtaButtonText(): string
    {
        return (string)$this->get_settings_for_display('secondary_cta_button_text');
    }

    public function getSecondaryCtaButtonUrl(): string
    {
        if ($this->get_settings_for_display('secondary_cta_custom_url_switch') === '1') {
            return $this->get_settings_for_display('secondary_cta_button_destination_custom');
        }

        return apply_filters(
            tdf_prefix() . '/button/destination',
            false,
            (string)$this->get_settings_for_display('secondary_cta_button_destination')
        );
    }

    public function getSecondaryCtaButtonType(): string
    {
        return (string)$this->get_settings_for_display('secondary_cta_type');
    }

    private function addMenuStretchControl(): void
    {
        $this->add_control(
            'menu_stretch',
            [
                'label' => esc_html__('Stretch', 'myhome-core'),
                'type' => Controls_Manager::SWITCHER,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__container' => 'max-width: 100% !important;'
                ]
            ]
        );
    }

    private function addMobileBreakpointControl(): void
    {
        $this->add_control(
            'mobile_breakpoint',
            [
                'label' => esc_html__('Mobile Breakpoint (px)', 'myhome-core'),
                'type' => Controls_Manager::NUMBER,
            ]
        );
    }

    public function getMobileBreakpoint(): int
    {
        $breakpoint = (int)$this->get_settings_for_display('mobile_breakpoint');
        if (empty($breakpoint)) {
            return 1120;
        }

        return $breakpoint;
    }

    protected function render(): void
    {
        parent::render();

        if (empty($this->getMobileBreakpoint())) {
            return;
        }
        ?>
        <style>
            @media (min-width: <?php echo esc_html($this->getMobileBreakpoint()); ?>px) {
                .myhome-menu--simple .myhome-menu__container {
                    flex-direction: row;
                }

                .myhome-menu--simple .myhome-menu__right {
                    display: flex;
                }

                .myhome-menu__button {
                    display: block;
                }

                .myhome-menu__mobile-button {
                    display: none;
                }

                .myhome-menu__separator {
                    display: block;
                }

                .myhome-menu__account-link {
                    display: block;
                }

                .myhome-menu__items {
                    display: flex;
                }
            }
        </style>
        <?php
    }

    private function addDesktopMenuItemControls(): void
    {
        $this->startStyleControlsSection('desktop_menu_item_style', esc_html__('Desktop Menu Item', 'myhome-core'));

        $this->add_control(
            'menu_item_circle_color',
            [
                'label' => esc_html__('Hover dot color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__items > .myhome-menu__item:before' => 'background-color: {{VALUE}};',
                ]
            ]
        );

        $this->start_controls_tabs('menu_item_style_tabs');

        $this->start_controls_tab(
            'menu_item',
            [
                'label' => esc_html__('Normal', 'myhome-core'),
            ]
        );

        $this->add_control(
            'menu_item_color',
            [
                'label' => esc_html__('Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__items > .myhome-menu__item' => 'color: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'menu_item_arrow_color',
            [
                'label' => esc_html__('Arrow Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__items > .myhome-menu__item > a path' => 'fill: {{VALUE}};',
                ]
            ]
        );

        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => esc_html__('Typography', 'myhome-core'),
                'name' => 'menu_item_typography',
                'selector' => '{{WRAPPER}} .myhome-menu__items > .myhome-menu__item > a',
            ]
        );

        $this->end_controls_tab();

        $this->start_controls_tab(
            'menu_item_hover_style_tab',
            [
                'label' => esc_html__('Hover', 'myhome-core'),
            ]
        );

        $this->add_control(
            'menu_item_hover_color',
            [
                'label' => esc_html__('Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__items > .myhome-menu__item:hover' => 'color: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'menu_item_arrow_hover_color',
            [
                'label' => esc_html__('Arrow Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__items > .myhome-menu__item:hover > a path' => 'fill: {{VALUE}};',
                ]
            ]
        );

        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => esc_html__('Typography', 'myhome-core'),
                'name' => 'menu_item_hover_typography',
                'selector' => '{{WRAPPER}} .myhome-menu__items > .myhome-menu__item:hover > a',
            ]
        );

        $this->end_controls_tab();

        $this->end_controls_tabs();

        $this->endControlsSection();
    }

    private function addDesktopSubmenuItemControls(): void
    {
        $this->startStyleControlsSection('desktop_submenu_item_style',
            esc_html__('Desktop Submenu Item', 'myhome-core'));

        $this->start_controls_tabs('submenu_item_style_tabs');

        $this->start_controls_tab(
            'submenu_item',
            [
                'label' => esc_html__('Normal', 'myhome-core'),
            ]
        );

        $this->add_control(
            'submenu_item_color',
            [
                'label' => esc_html__('Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__submenu .myhome-menu__item a' => 'color: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'submenu_item_arrow_color',
            [
                'label' => esc_html__('Arrow color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__submenu .myhome-menu__item a path' => 'fill: {{VALUE}};',
                ]
            ]
        );

        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => esc_html__('Typography', 'myhome-core'),
                'name' => 'submenu_item_typography',
                'selector' => '{{WRAPPER}} .myhome-menu__submenu .myhome-menu__item a',
            ]
        );

        $this->end_controls_tab();

        $this->start_controls_tab(
            'submenu_item_hover_style_tab',
            [
                'label' => esc_html__('Hover', 'myhome-core'),
            ]
        );

        $this->add_control(
            'submenu_item_hover_color',
            [
                'label' => esc_html__('Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__submenu .myhome-menu__item:hover > a' => 'color: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'submenu_item_arrow_hover_color',
            [
                'label' => esc_html__('Arrow color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__submenu .myhome-menu__item:hover > a path' => 'fill: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'submenu_item_arrow_hover_bg',
            [
                'label' => esc_html__('Background', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__submenu .myhome-menu__item:hover > a' => 'background-color: {{VALUE}};',
                ]
            ]
        );

        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => esc_html__('Typography', 'myhome-core'),
                'name' => 'submenu_item_hover_typography',
                'selector' => '{{WRAPPER}} .myhome-menu__submenu .myhome-menu__item:hover > a',
            ]
        );

        $this->end_controls_tab();

        $this->end_controls_tabs();

        $this->endControlsSection();
    }

    private function addMobileMenuControls(): void
    {
        $this->startStyleControlsSection('mobile_menu_style', esc_html__('Mobile Menu', 'myhome-core'));

        $this->add_control(
            'mobile_menu_bg',
            [
                'label' => esc_html__('Background', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu-mobile' => 'background-color: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'mobile_menu_top_bg',
            [
                'label' => esc_html__('Top background', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu-mobile__top' => 'background-color: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'mobile_menu_close_button_heading',
            [
                'label' => esc_html__('Close Button', 'myhome-core'),
                'type' => Controls_Manager::HEADING,
            ]
        );

        $this->add_control(
            'mobile_menu_close_button_color',
            [
                'label' => esc_html__('Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu-mobile__close path' => 'stroke: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'mobile_menu_close_button_border_color',
            [
                'label' => esc_html__('Border', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu-mobile__close' => 'border-color: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'mobile_menu_info_label_heading',
            [
                'label' => esc_html__('Contact information label', 'myhome-core'),
                'type' => Controls_Manager::HEADING,
            ]
        );

        $this->add_control(
            'mobile_menu_info_label_color',
            [
                'label' => esc_html__('Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu-mobile__data-label' => 'color: {{VALUE}};',
                ]
            ]
        );

        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name' => 'mobile_menu_info_label_typo',
                'label' => esc_html__('Typography', 'myhome-core'),
                'selector' => '{{WRAPPER}} .myhome-menu-mobile__data-label',
            ]
        );

        $this->add_control(
            'mobile_menu_info_value_heading',
            [
                'label' => esc_html__('Contact information value', 'myhome-core'),
                'type' => Controls_Manager::HEADING,
            ]
        );

        $this->add_control(
            'mobile_menu_info_value_color',
            [
                'label' => esc_html__('Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu-mobile__data-value' => 'color: {{VALUE}};',
                    '{{WRAPPER}} .myhome-menu-mobile__data-value a' => 'color: {{VALUE}};',
                ]
            ]
        );

        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'name' => 'mobile_menu_info_value_typo',
                'label' => esc_html__('Typography', 'myhome-core'),
                'selector' => '{{WRAPPER}} .myhome-menu-mobile__data-value',
            ]
        );

        $this->add_control(
            'mobile_menu_social_icons_heading',
            [
                'label' => esc_html__('Social icons', 'myhome-core'),
                'type' => Controls_Manager::HEADING,
            ]
        );

        $this->addSocialShareIconsControls();

        $this->endControlsSection();
    }

    private function addMobileMenuItemControls(): void
    {
        $this->startStyleControlsSection('mobile_menu_item_style', esc_html__('Mobile Menu Item', 'myhome-core'));

        $this->add_control(
            'mobile_menu_item_color',
            [
                'label' => esc_html__('Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu-mobile__items .myhome-menu-mobile__item a' => 'color: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'mobile_menu_item_bg',
            [
                'label' => esc_html__('Background', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu-mobile__item' => 'background-color: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'mobile_menu_item_sep',
            [
                'label' => esc_html__('Separator', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu-mobile__item a' => 'border-color: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'mobile_menu_item_arrow_color',
            [
                'label' => esc_html__('Arrow color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu-mobile__items .myhome-menu-mobile__item path' => 'fill: {{VALUE}};',
                ]
            ]
        );

        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => esc_html__('Typography', 'myhome-core'),
                'name' => 'mobile_menu_item_typography',
                'selector' => '{{WRAPPER}} .myhome-menu-mobile__items .myhome-menu-mobile__item a',
            ]
        );

        $this->endControlsSection();
    }

    private function addStickyMenuControls(): void
    {
        $this->startStyleControlsSection('sticky_menu_style', esc_html__('Sticky Menu', 'myhome-core'));

        $this->add_control(
            'sticky_menu_bg',
            [
                'label' => esc_html__('Background', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '.myhome-menu-sticky--active {{WRAPPER}} .myhome-menu' => 'background-color: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'sticky_menu_bottom_border_color',
            [
                'label' => esc_html__('Bottom border color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '.myhome-menu-sticky--active {{WRAPPER}} .myhome-menu__line' => 'background-color: {{VALUE}};'
                ]
            ]
        );

        $this->endControlsSection();
    }

    private function addStickyDesktopMenuItemControls(): void
    {
        $this->startStyleControlsSection('sticky_desktop_menu_item_style',
            esc_html__('Sticky Desktop Menu Item', 'myhome-core'));

        $this->add_control(
            'sticky_menu_item_circle_color',
            [
                'label' => esc_html__('Circle color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '.myhome-menu-sticky--active {{WRAPPER}} .myhome-menu__items > .myhome-menu__item:before' => 'background-color: {{VALUE}};',
                ]
            ]
        );

        $this->start_controls_tabs('sticky_menu_item_style_tabs');

        $this->start_controls_tab(
            'sticky_menu_item',
            [
                'label' => esc_html__('Normal', 'myhome-core'),
            ]
        );

        $this->add_control(
            'sticky_menu_item_color',
            [
                'label' => esc_html__('Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '.myhome-menu-sticky--active {{WRAPPER}} .myhome-menu__items > .myhome-menu__item' => 'color: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'sticky_menu_item_arrow_color',
            [
                'label' => esc_html__('Arrow color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '.myhome-menu-sticky--active {{WRAPPER}} .myhome-menu__items > .myhome-menu__item path' => 'fill: {{VALUE}};',
                ]
            ]
        );

        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => esc_html__('Typography', 'myhome-core'),
                'name' => 'sticky_menu_item_typography',
                'selector' => '.myhome-menu-sticky--active {{WRAPPER}} .myhome-menu__items > .myhome-menu__item',
            ]
        );

        $this->end_controls_tab();

        $this->start_controls_tab(
            'sticky_menu_item_hover_style_tab',
            [
                'label' => esc_html__('Hover', 'myhome-core'),
            ]
        );

        $this->add_control(
            'sticky_menu_item_hover_color',
            [
                'label' => esc_html__('Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '.myhome-menu-sticky--active {{WRAPPER}} .myhome-menu__items > .myhome-menu__item:hover' => 'color: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'sticky_menu_item_arrow_hover_color',
            [
                'label' => esc_html__('Arrow color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '.myhome-menu-sticky--active {{WRAPPER}} .myhome-menu__items > .myhome-menu__item:hover path' => 'fill: {{VALUE}};',
                ]
            ]
        );

        $this->add_group_control(
            Group_Control_Typography::get_type(),
            [
                'label' => esc_html__('Typography', 'myhome-core'),
                'name' => 'sticky_menu_item_hover_typography',
                'selector' => '.myhome-menu-sticky--active {{WRAPPER}} .myhome-menu__items > .myhome-menu__item:hover',
            ]
        );

        $this->end_controls_tab();

        $this->end_controls_tabs();

        $this->endControlsSection();
    }

    private function addHamburgerIconStyleControls(): void
    {
        $this->add_control(
            'hamburger_icon_style_heading',
            [
                'label' => esc_html__('Hamburger Icon', 'myhome-core'),
                'type' => Controls_Manager::HEADING,
            ]
        );

        $this->add_control(
            'hamburger_icon_color',
            [
                'label' => esc_html__('Color', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__mobile-button svg path' => 'fill: {{VALUE}};',
                ]
            ]
        );

        $this->add_control(
            'hamburger_icon_border',
            [
                'label' => esc_html__('Border', 'myhome-core'),
                'type' => Controls_Manager::COLOR,
                'selectors' => [
                    '{{WRAPPER}} .myhome-menu__mobile-button' => 'border-color: {{VALUE}};',
                ]
            ]
        );
    }
}