<?php defined('ABSPATH') or die("No script kiddies please!"); ?>
<div class="wpfm-menu-wrapper wpfm-<?php echo $template; ?>" menu-id="<?php echo $menu_data->id; ?>">
    <nav id="wpfm-floating-menu-nav" class="wpfm-menu-nav wpfm wpfm-position-<?php echo $menu_position; ?>">    
        <ul class="wpfm-nav wpfm-nav-show-hide" style="display:none;">
            <?php
            foreach ($menu_structure_detail as $key => $val) {
                if (!empty($val["wpfm_target_link_address"])) {
                    $wpfm_href_address = esc_attr($val["wpfm_target_link_address"]);
                }
                if (isset($val["wpfm_field_link_target"]) && $val["wpfm_field_link_target"] != '') {
                    $wpfm_link_target = 'target="_blank"';
                } else {
                    $wpfm_link_target = '';
                }
                if (isset($val["wpfm_tooltip_show"]) && $val["wpfm_tooltip_show"] == '' && !empty($val["wpfm_menu_tooltip_title"])) {
                    $tooltip_title = esc_attr($val["wpfm_menu_tooltip_title"]);
                }
                if (isset($template) && $template == 'template-5') {
                    $expand_icon = 'fa fa-bars';
                }
                ?>
                <li class="<?php
                if (!(isset($val["wpfm_title_show"])) || $val["wpfm_title_show"] == '1') {
                    echo 'wpfm-title-hidden';
                }
                ?>">
                    <a title="<?php
                    if (!empty($val['wpfm_menu_item_title_attribute'])) {
                        echo esc_attr($val['wpfm_menu_item_title_attribute']);
                    }
                    ?>" class="wpfm-menu-link" href="<?php echo esc_url($wpfm_href_address); ?>" <?php echo esc_attr($wpfm_link_target); ?> <?php
                       if (isset($wpfm_settings['menu_link_add_nofollow']) && $wpfm_settings['menu_link_add_nofollow'] == 1) {
                           echo 'rel="nofollow"';
                       }
                       ?>>
                        <span class='wpfm-icon-block'>                
                            <?php
                            if (((isset($val['icon_icon_type']) && $val['icon_icon_type'] == 'default') && (isset($val['icon_picker_settings']) && $val['icon_picker_settings'] != '')) || !isset($val['icon_icon_type']) && (isset($val['icon_picker_settings']) && $val['icon_picker_settings'] != '')) {
                                $v = explode('|', esc_attr($val['icon_picker_settings']));
                                ?>
                                <i <?php
                                if (isset($icon_color)) {
                                    echo esc_attr($icon_color);
                                }
                                ?> class="<?php echo $v[0] . ' ' . $v[1]; ?>" aria-hidden="true"></i><?php } else if ((isset($val['icon_icon_type']) && $val['icon_icon_type'] == 'custom') && (isset($val['icon_picker_custom']) && $val['icon_picker_custom'] != '')) {
                                ?> 
                                <i <?php
                                if (isset($icon_color)) {
                                    echo esc_attr($icon_color);
                                }
                                ?>class="<?php echo $val['icon_picker_custom']; ?>" aria-hidden="true"></i>
                                <?php } ?>      
                        </span>           
                        <?php if (isset($val['wpfm_menu_item_title']) && !empty($val['wpfm_menu_item_title']) && (isset($val["wpfm_title_show"]) && $val["wpfm_title_show"] == '1')) {
                            ?>
                            <span class='name wpfm-menu-name'>
                                <?php echo esc_attr($val['wpfm_menu_item_title']); ?>
                            </span>
                        <?php }
                        ?>                     
                    </a>
                    <?php if (isset($val["wpfm_tooltip_show"]) && $val["wpfm_tooltip_show"] == '1' && !empty($val["wpfm_menu_tooltip_title"])) {
                        ?>
                        <span class='tooltip wpfm-tootltip-title'>
                            <?php
                            if (isset($val['wpfm_menu_tooltip_title']) && !empty($val['wpfm_menu_tooltip_title'])) {
                                echo esc_attr($val['wpfm_menu_tooltip_title']);
                            }
                            ?>
                        </span>
                    <?php } ?>
                </li>
            <?php } ?>
            <a class="wpfm-nav-close-trigger wpfm-menu-link" href="javascript:void(0)" id="<?php echo $menu_position; ?>">
                <span aria-hidden="true"><i class="fa fa-times"></i></span>
            </a>       
        </ul>
        <a class="wpfm-nav-strech-trigger" href="javascript:void(0)" id="<?php echo $menu_position; ?>">
            <span aria-hidden="true"><i class="<?php echo $expand_icon; ?>"></i></span>
        </a>              
    </nav>
</div>