Skip to content

Commit

Permalink
Add feature display menu via a Module Position
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed May 29, 2024
1 parent e975612 commit afef57c
Show file tree
Hide file tree
Showing 10 changed files with 249 additions and 61 deletions.
23 changes: 19 additions & 4 deletions framework/frontend/header/horizontal.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
$block_2_type = $params->get('header_block_2_type', 'blank');
$block_2_position = $params->get('header_block_2_position', '');
$block_2_custom = $params->get('header_block_2_custom', '');
$header_menu_method = $params->get('header_menu_method', 'default');
$header_menu = $params->get('header_menu', 'mainmenu');
$header_menu_module_position = $params->get('header_menu_module_position', 'astroid-header-menu');
$header_breakpoint = $params->get('header_breakpoint', 'lg');
$enable_offcanvas = $params->get('enable_offcanvas', FALSE);
$header_mobile_menu = $params->get('header_mobile_menu', '');
Expand All @@ -37,9 +39,10 @@
$class = ['astroid-header', 'astroid-horizontal-header', 'astroid-horizontal-' . $mode . '-header'];
$navClass = ['nav', 'astroid-nav', 'd-none', 'd-'.$header_breakpoint.'-flex'];
$navWrapperClass = ['align-self-center', 'px-2', 'd-none', 'd-'.$header_breakpoint.'-block'];
$headAttrs = $header_menu_method == 'default' ? ' data-megamenu data-megamenu-class=".has-megamenu" data-megamenu-content-class=".megamenu-container" data-dropdown-arrow="'.($params->get('dropdown_arrow', 0) ? 'true' : 'false').'" data-header-offset="true" data-transition-speed="'.$params->get('dropdown_animation_speed', 300).'" data-megamenu-animation="'.$params->get('dropdown_animation_type', 'fade').'" data-easing="'.$params->get('dropdown_animation_ease', 'linear').'" data-astroid-trigger="'.$params->get('dropdown_trigger', 'hover').'" data-megamenu-submenu-class=".nav-submenu,.nav-submenu-static"' : '';
?>
<!-- header starts -->
<header data-megamenu data-megamenu-class=".has-megamenu" data-megamenu-content-class=".megamenu-container" data-dropdown-arrow="<?php echo $params->get('dropdown_arrow', 0) ? 'true' : 'false'; ?>" data-header-offset="true" data-transition-speed="<?php echo $params->get('dropdown_animation_speed', 300); ?>" data-megamenu-animation="<?php echo $params->get('dropdown_animation_type', 'fade'); ?>" data-easing="<?php echo $params->get('dropdown_animation_ease', 'linear'); ?>" data-astroid-trigger="<?php echo $params->get('dropdown_trigger', 'hover'); ?>" data-megamenu-submenu-class=".nav-submenu,.nav-submenu-static" id="astroid-header" class="<?php echo implode(' ', $class); ?>">
<header id="astroid-header" class="<?php echo implode(' ', $class); ?>"<?php echo $headAttrs; ?>>
<div class="d-flex flex-row justify-content-between">
<?php if (!empty($header_mobile_menu)) { ?>
<div class="d-flex d-<?php echo $header_breakpoint; ?>-none justify-content-start">
Expand Down Expand Up @@ -74,7 +77,11 @@
<?php
if ($mode == 'left') {
// header nav starts
Astroid\Component\Menu::getMenu($header_menu, $navClass, null, 'left', 'horizontal', $navWrapperClass);
if ($header_menu_method == 'module_position') {
echo $document->position($header_menu_module_position);
} else {
Astroid\Component\Menu::getMenu($header_menu, $navClass, null, 'left', 'horizontal', $navWrapperClass);
}
// header nav ends
}
?>
Expand All @@ -86,7 +93,11 @@
if ($mode == 'center') {
echo '<div class="header-center-section d-none d-'.$header_breakpoint.'-flex justify-content-center' . ($mode == 'center' ? ' flex-'.$header_breakpoint.'-grow-1' : '') . '">';
// header nav starts
Astroid\Component\Menu::getMenu($header_menu, $navClass, null, 'left', 'horizontal', $navWrapperClass);
if ($header_menu_method == 'module_position') {
echo $document->position($header_menu_module_position);
} else {
Astroid\Component\Menu::getMenu($header_menu, $navClass, null, 'left', 'horizontal', $navWrapperClass);
}
// header nav ends
echo '</div>';
}
Expand All @@ -96,7 +107,11 @@
<?php
if ($mode == 'right') {
// header nav starts
Astroid\Component\Menu::getMenu($header_menu, $navClass, null, 'left', 'horizontal', $navWrapperClass);
if ($header_menu_method == 'module_position') {
echo $document->position($header_menu_module_position);
} else {
Astroid\Component\Menu::getMenu($header_menu, $navClass, null, 'left', 'horizontal', $navWrapperClass);
}
// header nav ends
}
?>
Expand Down
10 changes: 9 additions & 1 deletion framework/frontend/header/sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
$block_1_position = $params->get('header_block_1_position', '');
$block_1_custom = $params->get('header_block_1_custom', '');
$header_menu = $params->get('header_menu', 'mainmenu');
$header_menu_method = $params->get('header_menu_method', 'default');
$header_menu_module_position = $params->get('header_menu_module_position', 'astroid-header-menu');
$enable_offcanvas = $params->get('enable_offcanvas', FALSE);
$header_mobile_menu = $params->get('header_mobile_menu', '');
$offcanvas_animation = $params->get('offcanvas_animation', 'st-effect-1');
Expand Down Expand Up @@ -79,7 +81,13 @@
</div>
<?php endif; ?>
<div class="astroid-sidebar-menu">
<?php Astroid\Component\Menu::getSidebarMenu($header_menu); ?>
<?php
if ($header_menu_method == 'module_position') {
echo $document->position($header_menu_module_position);
} else {
Astroid\Component\Menu::getSidebarMenu($header_menu);
}
?>
</div>
<?php if ($block_2_type != 'blank') : ?>
<div class="astroid-sidebar-block astroid-sidebar-block-2">
Expand Down
64 changes: 43 additions & 21 deletions framework/frontend/header/stacked.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
$block_3_custom = $params->get('header_block_3_custom', '');
$header_mobile_menu = $params->get('header_mobile_menu', '');
$header_menu = $params->get('header_menu', '');
$header_menu_method = $params->get('header_menu_method', 'default');
$header_menu_module_position = $params->get('header_menu_module_position', 'astroid-header-menu');
$header_breakpoint = $params->get('header_breakpoint', 'lg');
$odd_menu_items = $params->get('odd_menu_items', 'left');
$divided_logo_width = $params->get('divided_logo_width', 200);
Expand Down Expand Up @@ -144,13 +146,17 @@

echo '</div>';
// header nav starts -->
?>
<div data-megamenu data-megamenu-class=".has-megamenu" data-megamenu-content-class=".megamenu-container" data-dropdown-arrow="<?php echo $params->get('dropdown_arrow', 0) ? 'true' : 'false'; ?>" data-header-offset="true" data-transition-speed="<?php echo $params->get('dropdown_animation_speed', 300); ?>" data-megamenu-animation="<?php echo $params->get('dropdown_animation_type', 'fade'); ?>" data-easing="<?php echo $params->get('dropdown_animation_ease', 'linear'); ?>" data-astroid-trigger="<?php echo $params->get('dropdown_trigger', 'hover'); ?>" data-megamenu-submenu-class=".nav-submenu" class="astroid-header-center-balance-menu w-100 d-none d-<?php echo $header_breakpoint; ?>-flex justify-content-center pt-3">
<?php
Astroid\Component\Menu::getMenu($header_menu, array_merge($navClass), null, 'left', 'stacked', $navWrapperClass);
if ($header_menu_method == 'module_position') {
echo $document->position($header_menu_module_position);
} else {
?>
</div>
<?php
<div data-megamenu data-megamenu-class=".has-megamenu" data-megamenu-content-class=".megamenu-container" data-dropdown-arrow="<?php echo $params->get('dropdown_arrow', 0) ? 'true' : 'false'; ?>" data-header-offset="true" data-transition-speed="<?php echo $params->get('dropdown_animation_speed', 300); ?>" data-megamenu-animation="<?php echo $params->get('dropdown_animation_type', 'fade'); ?>" data-easing="<?php echo $params->get('dropdown_animation_ease', 'linear'); ?>" data-astroid-trigger="<?php echo $params->get('dropdown_trigger', 'hover'); ?>" data-megamenu-submenu-class=".nav-submenu" class="astroid-header-center-balance-menu w-100 d-none d-<?php echo $header_breakpoint; ?>-flex justify-content-center pt-3">
<?php
Astroid\Component\Menu::getMenu($header_menu, array_merge($navClass), null, 'left', 'stacked', $navWrapperClass);
?>
</div>
<?php
}
// header nav ends
}

Expand Down Expand Up @@ -184,13 +190,17 @@
}
echo '</div>';
// header nav starts -->
?>
<div data-megamenu data-megamenu-class=".has-megamenu" data-megamenu-content-class=".megamenu-container" data-dropdown-arrow="<?php echo $params->get('dropdown_arrow', 0) ? 'true' : 'false'; ?>" data-header-offset="true" data-transition-speed="<?php echo $params->get('dropdown_animation_speed', 300); ?>" data-megamenu-animation="<?php echo $params->get('dropdown_animation_type', 'fade'); ?>" data-easing="<?php echo $params->get('dropdown_animation_ease', 'linear'); ?>" data-astroid-trigger="<?php echo $params->get('dropdown_trigger', 'hover'); ?>" data-megamenu-submenu-class=".nav-submenu" class="astroid-stacked-<?php echo $mode; ?>-menu w-100 d-none d-<?php echo $header_breakpoint; ?>-flex justify-content-center pt-3">
<?php
Astroid\Component\Menu::getMenu($header_menu, array_merge($navClass), null, 'left', 'stacked', $navWrapperClass);
?>
</div>
<?php
if ($header_menu_method == 'module_position') {
echo $document->position($header_menu_module_position);
} else {
?>
<div data-megamenu data-megamenu-class=".has-megamenu" data-megamenu-content-class=".megamenu-container" data-dropdown-arrow="<?php echo $params->get('dropdown_arrow', 0) ? 'true' : 'false'; ?>" data-header-offset="true" data-transition-speed="<?php echo $params->get('dropdown_animation_speed', 300); ?>" data-megamenu-animation="<?php echo $params->get('dropdown_animation_type', 'fade'); ?>" data-easing="<?php echo $params->get('dropdown_animation_ease', 'linear'); ?>" data-astroid-trigger="<?php echo $params->get('dropdown_trigger', 'hover'); ?>" data-megamenu-submenu-class=".nav-submenu" class="astroid-stacked-<?php echo $mode; ?>-menu w-100 d-none d-<?php echo $header_breakpoint; ?>-flex justify-content-center pt-3">
<?php
Astroid\Component\Menu::getMenu($header_menu, array_merge($navClass), null, 'left', 'stacked', $navWrapperClass);
?>
</div>
<?php
}
// header nav ends
// header block starts
if ($block_1_type == 'position') {
Expand Down Expand Up @@ -241,7 +251,11 @@
if (!empty($logo)) {
echo '<div class="d-'.$header_breakpoint.'-none">' . $logo . '</div>';
}
Astroid\Component\Menu::getMenu($header_menu, $navClass, true, $odd_menu_items, 'stacked', $navWrapperClass);
if ($header_menu_method == 'module_position') {
echo $document->position($header_menu_module_position);
} else {
Astroid\Component\Menu::getMenu($header_menu, $navClass, true, $odd_menu_items, 'stacked', $navWrapperClass);
}
echo '</div>';

// header block starts
Expand Down Expand Up @@ -319,7 +333,11 @@
<div data-megamenu data-megamenu-class=".has-megamenu" data-megamenu-content-class=".megamenu-container" data-dropdown-arrow="<?php echo $params->get('dropdown_arrow', 0) ? 'true' : 'false'; ?>" data-header-offset="true" data-transition-speed="<?php echo $params->get('dropdown_animation_speed', 300); ?>" data-megamenu-animation="<?php echo $params->get('dropdown_animation_type', 'fade'); ?>" data-easing="<?php echo $params->get('dropdown_animation_ease', 'linear'); ?>" data-astroid-trigger="<?php echo $params->get('dropdown_trigger', 'hover'); ?>" data-megamenu-submenu-class=".nav-submenu" class="astroid-stacked-<?php echo $mode; ?>-menu as-megamenu-section d-none d-<?php echo $header_breakpoint; ?>-block py-2">
<div class="row">
<?php
Astroid\Component\Menu::getMenu($header_menu, $navClassLeft, null, 'left', 'stacked', ['astroid-nav-wraper', 'col']);
if ($header_menu_method == 'module_position') {
echo '<div class="col">' . $document->position($header_menu_module_position) . '</div>';
} else {
Astroid\Component\Menu::getMenu($header_menu, $navClassLeft, null, 'left', 'stacked', ['astroid-nav-wraper', 'col']);
}
// header block starts
if ($block_2_type == 'position') {
echo '<div class="d-flex col-auto">';
Expand Down Expand Up @@ -405,13 +423,17 @@
<?php $document->include('offcanvas.trigger', ['offcanvas' => '#astroid-offcanvas', 'visibility' => $offcanvas_togglevisibility, 'effect' => $offcanvas_animation, 'direction' => $offcanvas_direction]); ?>
<?php echo '</div>'; ?>
<?php }
?>
<div data-megamenu data-megamenu-class=".has-megamenu" data-megamenu-content-class=".megamenu-container" data-dropdown-arrow="<?php echo $params->get('dropdown_arrow', 0) ? 'true' : 'false'; ?>" data-header-offset="true" data-transition-speed="<?php echo $params->get('dropdown_animation_speed', 300); ?>" data-megamenu-animation="<?php echo $params->get('dropdown_animation_type', 'fade'); ?>" data-easing="<?php echo $params->get('dropdown_animation_ease', 'linear'); ?>" data-astroid-trigger="<?php echo $params->get('dropdown_trigger', 'hover'); ?>" data-megamenu-submenu-class=".nav-submenu" class="astroid-stacked-<?php echo $mode; ?>-menu d-flex justify-content-start flex-<?php echo $header_breakpoint; ?>-grow-1">
<?php
Astroid\Component\Menu::getMenu($header_menu, $navClassLeft, null, 'left', 'stacked', $navWrapperClass);
if ($header_menu_method == 'module_position') {
echo $document->position($header_menu_module_position);
} else {
?>
</div>
<?php
<div data-megamenu data-megamenu-class=".has-megamenu" data-megamenu-content-class=".megamenu-container" data-dropdown-arrow="<?php echo $params->get('dropdown_arrow', 0) ? 'true' : 'false'; ?>" data-header-offset="true" data-transition-speed="<?php echo $params->get('dropdown_animation_speed', 300); ?>" data-megamenu-animation="<?php echo $params->get('dropdown_animation_type', 'fade'); ?>" data-easing="<?php echo $params->get('dropdown_animation_ease', 'linear'); ?>" data-astroid-trigger="<?php echo $params->get('dropdown_trigger', 'hover'); ?>" data-megamenu-submenu-class=".nav-submenu" class="astroid-stacked-<?php echo $mode; ?>-menu d-flex justify-content-start flex-<?php echo $header_breakpoint; ?>-grow-1">
<?php
Astroid\Component\Menu::getMenu($header_menu, $navClassLeft, null, 'left', 'stacked', $navWrapperClass);
?>
</div>
<?php
}
if ($block_3_type != '') {
if ($block_3_type == 'position') {
echo '<div class="d-flex header-block-item justify-content-end align-items-center">';
Expand Down
23 changes: 19 additions & 4 deletions framework/frontend/header/sticky.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
$color_mode = $template->getColorMode();

$header_menu = $params->get('header_menu', 'mainmenu');
$header_menu_method = $params->get('header_menu_method', 'default');
$header_menu_module_position = $params->get('header_menu_module_position', 'astroid-header-menu');
$header_breakpoint = $params->get('header_breakpoint', 'lg');
$enable_offcanvas = $params->get('enable_offcanvas', FALSE);
$offcanvas_animation = $params->get('offcanvas_animation', 'st-effect-1');
Expand Down Expand Up @@ -51,9 +53,10 @@
$navWrapperClass[] = 'mx-auto';
break;
}
$headAttrs = $header_menu_method == 'default' ? ' data-megamenu data-megamenu-class=".has-megamenu" data-megamenu-content-class=".megamenu-container" data-dropdown-arrow="'.($params->get('dropdown_arrow', 0) ? 'true' : 'false').'" data-header-offset="true" data-transition-speed="'.$params->get('dropdown_animation_speed', 300).'" data-megamenu-animation="'.$params->get('dropdown_animation_type', 'fade').'" data-easing="'.$params->get('dropdown_animation_ease', 'linear').'" data-astroid-trigger="'.$params->get('dropdown_trigger', 'hover').'" data-megamenu-submenu-class=".nav-submenu"' : '';
?>
<!-- header starts -->
<header id="astroid-sticky-header" data-megamenu data-megamenu-class=".has-megamenu" data-megamenu-content-class=".megamenu-container" data-dropdown-arrow="<?php echo $params->get('dropdown_arrow', 0) ? 'true' : 'false'; ?>" data-header-offset="true" data-transition-speed="<?php echo $params->get('dropdown_animation_speed', 300); ?>" data-megamenu-animation="<?php echo $params->get('dropdown_animation_type', 'fade'); ?>" data-easing="<?php echo $params->get('dropdown_animation_ease', 'linear'); ?>" data-astroid-trigger="<?php echo $params->get('dropdown_trigger', 'hover'); ?>" data-megamenu-submenu-class=".nav-submenu" class="<?php echo implode(' ', $class); ?> d-none">
<header id="astroid-sticky-header" class="<?php echo implode(' ', $class); ?> d-none"<?php echo $headAttrs; ?>>
<div class="container d-flex flex-row justify-content-between">
<?php if (!empty($header_mobile_menu)) { ?>
<div class="d-flex d-<?php echo $header_breakpoint; ?>-none justify-content-start">
Expand All @@ -72,7 +75,11 @@
<?php
if ($stickey_mode == 'left') {
// header nav starts
Astroid\Component\Menu::getMenu($header_menu, $navClass, null, 'left', 'sticky', $navWrapperClass);
if ($header_menu_method == 'module_position') {
echo $document->position($header_menu_module_position);
} else {
Astroid\Component\Menu::getMenu($header_menu, $navClass, null, 'left', 'sticky', $navWrapperClass);
}
// header nav ends
}
?>
Expand All @@ -84,7 +91,11 @@
if ($stickey_mode == 'center') {
echo '<div class="header-center-section d-none d-'.$header_breakpoint.'-flex justify-content-center' . ($stickey_mode == 'center' ? ' flex-'.$header_breakpoint.'-grow-1' : '') . '">';
// header nav starts
Astroid\Component\Menu::getMenu($header_menu, $navClass, null, 'left', 'sticky', $navWrapperClass);
if ($header_menu_method == 'module_position') {
echo $document->position($header_menu_module_position);
} else {
Astroid\Component\Menu::getMenu($header_menu, $navClass, null, 'left', 'sticky', $navWrapperClass);
}
// header nav ends
echo '</div>';
}
Expand All @@ -94,7 +105,11 @@
<?php
if ($stickey_mode == 'right') {
// header nav starts
Astroid\Component\Menu::getMenu($header_menu, $navClass, null, 'left', 'sticky', $navWrapperClass);
if ($header_menu_method == 'module_position') {
echo $document->position($header_menu_module_position);
} else {
Astroid\Component\Menu::getMenu($header_menu, $navClass, null, 'left', 'sticky', $navWrapperClass);
}
// header nav ends
}
?>
Expand Down
Loading

0 comments on commit afef57c

Please sign in to comment.