get_name(), 'eicon-lock-user' ); } /** * Get widget keywords. * * Retrieve the list of keywords the widget belongs to. * * @access public * * @return array Widget keywords. */ public function get_keywords() { return [ 'opalestate-pro', 'account', 'button' ]; } private function get_available_menus() { $menus = wp_get_nav_menus(); $options = []; foreach ( $menus as $menu ) { $options[ $menu->slug ] = $menu->name; } return $options; } /** * Register icon box widget controls. * * Adds different input fields to allow the user to change and customize the widget settings. * * @access protected */ protected function _register_controls() { $this->start_controls_section( 'account_content', [ 'label' => esc_html__( 'Not logged in', 'opalestate-pro' ), ] ); $this->add_control( 'icon', [ 'label' => esc_html__( 'Choose Icon', 'opalestate-pro' ), 'type' => Controls_Manager::ICON, 'default' => 'fa fa-user', ] ); $this->add_control( 'enable_label', [ 'label' => esc_html__( 'Enable Label', 'opalestate-pro' ), 'type' => Controls_Manager::SWITCHER, ] ); $this->add_control( 'label_text', [ 'label' => esc_html__( 'Label Text', 'opalestate-pro' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Account', 'opalestate-pro' ), 'condition' => [ 'enable_label' => 'yes' ], ] ); $this->end_controls_section(); $this->start_controls_section( 'account_logged_in', [ 'label' => esc_html__( 'Logged in', 'opalestate-pro' ), ] ); $this->add_control( 'logged_in_enable_avatar', [ 'label' => esc_html__( 'Enable Avatar', 'opalestate-pro' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'on', ] ); $this->add_control( 'logged_in_enable_notification', [ 'label' => esc_html__( 'Enable Notification', 'opalestate-pro' ), 'type' => Controls_Manager::SWITCHER, ] ); $this->add_control( 'logged_in_icon', [ 'label' => esc_html__( 'Choose Icon', 'opalestate-pro' ), 'type' => Controls_Manager::ICON, 'default' => 'fa fa-user', ] ); $this->add_control( 'logged_in_enable_label', [ 'label' => esc_html__( 'Enable Label', 'opalestate-pro' ), 'type' => Controls_Manager::SWITCHER, ] ); $this->add_control( 'logged_in_label_text', [ 'label' => esc_html__( 'Label Text', 'opalestate-pro' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Account', 'opalestate-pro' ), 'condition' => [ 'logged_in_enable_label' => 'yes' ], ] ); $menus = $this->get_available_menus(); if ( ! empty( $menus ) ) { $this->add_control( 'enable_custom_menu', [ 'label' => esc_html__( 'Use Custom Dashboard Menu', 'opalestate-pro' ), 'type' => Controls_Manager::SWITCHER, ] ); $this->add_control( 'menu', [ 'label' => esc_html__( 'Menu', 'opalestate-pro' ), 'type' => Controls_Manager::SELECT, 'options' => $menus, 'default' => 'my-account', 'save_default' => true, 'separator' => 'after', 'description' => sprintf( esc_html__( 'Go to the Menus screen to manage your menus.', 'opalestate-pro' ), admin_url( 'nav-menus.php' ) ), 'condition' => [ 'enable_custom_menu' => 'yes' ], ] ); } $this->end_controls_section(); $this->start_controls_section( 'section_general_style_content', [ 'label' => esc_html__( 'General', 'opalestate-pro' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'toggle_align', [ 'label' => esc_html__( 'Alignment', 'opalestate-pro' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__( 'Left', 'opalestate-pro' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => esc_html__( 'Center', 'opalestate-pro' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => esc_html__( 'Right', 'opalestate-pro' ), 'icon' => 'eicon-h-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .elementor-widget-container' => 'text-align: {{VALUE}}', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_label_style_content', [ 'label' => esc_html__( 'Label', 'opalestate-pro' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'title_color', [ 'label' => esc_html__( 'Color', 'opalestate-pro' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .site-header-account .account-label' => 'color: {{VALUE}};', ], 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_1, ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .site-header-account .account-label', 'scheme' => Scheme_Typography::TYPOGRAPHY_1, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_icon_style_content', [ 'label' => esc_html__( 'Icon', 'opalestate-pro' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'tabs_icon_style' ); $this->start_controls_tab( 'tab_icon_normal', [ 'label' => esc_html__( 'Normal', 'opalestate-pro' ), ] ); $this->add_control( 'icon_color', [ 'label' => esc_html__( 'Icon Color', 'opalestate-pro' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .site-header-account i' => 'color: {{VALUE}};', ], 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_1, ], ] ); $this->add_control( 'background_color', [ 'label' => esc_html__( 'Background Color', 'opalestate-pro' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .site-header-account i' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'icon_fontsize', [ 'label' => esc_html__( 'Icon Font Size', 'opalestate-pro' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .site-header-account i' => 'font-size: {{SIZE}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'icon_border', 'placeholder' => '1px', 'default' => '1px', 'selector' => '{{WRAPPER}} .site-header-account i', 'separator' => 'before', ] ); $this->add_control( 'icon_border_radius', [ 'label' => esc_html__( 'Border Radius', 'opalestate-pro' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .site-header-account i' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'icon_padding', [ 'label' => esc_html__( 'Padding', 'opalestate-pro' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .site-header-account i' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_icon_hover', [ 'label' => esc_html__( 'Hover', 'opalestate-pro' ), ] ); $this->add_control( 'icon_color_hover', [ 'label' => esc_html__( 'Icon Color', 'opalestate-pro' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .site-header-account i:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'background_color_hover', [ 'label' => esc_html__( 'Background Color', 'opalestate-pro' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .site-header-account i:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'icon_border_hover', 'placeholder' => '1px', 'default' => '1px', 'selector' => '{{WRAPPER}} .site-header-account i:hover', 'separator' => 'before', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings(); $this->show_poup_hover_form( $settings ); } protected function show_poup_hover_form( $settings ) { $settings = wp_parse_args( $settings, [ 'enable_label' => false, 'icon' => '', 'style' => '', ] ); $account_link = opalestate_my_account_page(); $id = rand( 2, 9 ) . rand( 0, 9 ); ?>
' . ( $settings['enable_label'] && $settings['label_text'] ? '' : '' ) . ' '; ?>