<?php
function hmenu_2() {
    $view = JFactory::getDocument()->view;
    $modulesContains = $view->containsModules('hmenu');
    $isPreview  = $GLOBALS['theme_settings']['is_preview'];
    if (isset($GLOBALS['isModuleContentExists']) && false == $GLOBALS['isModuleContentExists'])
        $GLOBALS['isModuleContentExists'] = $view->containsModules('hmenu') ? true : false;
    ?>
    <?php if ($isPreview || $modulesContains) : ?>
        
        <nav class=" bd-hmenu-2" data-responsive-menu="true" data-responsive-levels="expand on click">
            <?php if ($view->containsModules('hmenu')) : ?>
            
                <div class=" bd-responsivemenu-3 collapse-button">
    <div class="bd-container-inner">
        <div class="bd-menuitem-26 ">
            <a  data-toggle="collapse"
                data-target=".bd-hmenu-2 .collapse-button + .navbar-collapse"
                href="#" onclick="return false;">
                    <span>MENU</span>
            </a>
        </div>
    </div>
</div>
                <div class="navbar-collapse collapse">
            <?php echo $view->position('hmenu', '', '2', 'hmenu'); ?>
            
                </div>
            <?php else: ?>
                Please add a menu module in the 'hmenu' position
            <?php endif; ?>
        </nav>
        
    <?php endif; ?>
<?php
}