feat(nav): rewrite top header to zibll 1:1 DOM/CSS/JS contract
Replace hybrid site-nav/drawer shell with zibll navbar-top layouts 1/2/3, body.mobile-navbar-show drawer, wired NavWalker + aksrt_menu_options meta, nav_folding/chevron, VIP switches, and SPA/PHP schema parity. No dual-class compat paths.
This commit is contained in:
1 parent
b8ee6b6a43
commit
259dbdbe04
28 files changed
+2463
-885
No files matched your search
@@ -14,13 +14,17 @@ trait FacadeBulk {
|
||||
/**
|
||||
* Header navigation display settings.
|
||||
*
|
||||
* @return array{fixed:bool,search_enabled:bool,user_menu:bool,publish_btn:bool,mobile_drawer:bool,nav_style:string,max_width:int,scroll_down_hide:bool,layout:string,mobile_layout:string,mobile_align:string}
|
||||
* @return array{
|
||||
* fixed:bool,search_enabled:bool,user_menu:bool,publish_btn:bool,mobile_drawer:bool,
|
||||
* nav_style:string,max_width:int,scroll_down_hide:bool,layout:string,mobile_layout:string,
|
||||
* mobile_align:string,nav_pay_vip:bool,nav_user_pay_vip:bool
|
||||
* }
|
||||
*/
|
||||
public static function get_header_nav_settings(): array {
|
||||
$settings = self::get_all();
|
||||
$nav_style = sanitize_key((string) ($settings['header_nav_style'] ?? 'default'));
|
||||
$max_width = (int) ($settings['header_max_width'] ?? 1200);
|
||||
$layout = sanitize_key((string) ($settings['header_layout'] ?? '2'));
|
||||
$layout = sanitize_key((string) ($settings['header_layout'] ?? '1'));
|
||||
$ml = sanitize_key((string) ($settings['mobile_header_layout'] ?? 'center'));
|
||||
$ma = sanitize_key((string) ($settings['mobile_navbar_align'] ?? 'left'));
|
||||
|
||||
@@ -33,17 +37,20 @@ trait FacadeBulk {
|
||||
}
|
||||
|
||||
return [
|
||||
'fixed' => !isset($settings['header_fixed']) || !empty($settings['header_fixed']),
|
||||
'search_enabled' => !isset($settings['header_search_enabled']) || !empty($settings['header_search_enabled']),
|
||||
'user_menu' => !isset($settings['header_user_menu']) || !empty($settings['header_user_menu']),
|
||||
'publish_btn' => !isset($settings['header_publish_btn']) || !empty($settings['header_publish_btn']),
|
||||
'mobile_drawer' => !isset($settings['header_mobile_drawer']) || !empty($settings['header_mobile_drawer']),
|
||||
'nav_style' => $nav_style,
|
||||
'max_width' => $max_width,
|
||||
'scroll_down_hide'=> !empty($settings['header_scroll_down_hide']),
|
||||
'layout' => in_array($layout, ['1', '2', '3'], true) ? $layout : '2',
|
||||
'mobile_layout' => in_array($ml, ['center', 'left'], true) ? $ml : 'center',
|
||||
'mobile_align' => in_array($ma, ['top', 'left', 'right'], true) ? $ma : 'left',
|
||||
'fixed' => !isset($settings['header_fixed']) || !empty($settings['header_fixed']),
|
||||
'search_enabled' => !isset($settings['header_search_enabled']) || !empty($settings['header_search_enabled']),
|
||||
'user_menu' => !isset($settings['header_user_menu']) || !empty($settings['header_user_menu']),
|
||||
'publish_btn' => !isset($settings['header_publish_btn']) || !empty($settings['header_publish_btn']),
|
||||
'mobile_drawer' => !isset($settings['header_mobile_drawer']) || !empty($settings['header_mobile_drawer']),
|
||||
'nav_style' => $nav_style,
|
||||
'max_width' => $max_width,
|
||||
// Zibll default: true when fixed.
|
||||
'scroll_down_hide' => !isset($settings['header_scroll_down_hide']) || !empty($settings['header_scroll_down_hide']),
|
||||
'layout' => in_array($layout, ['1', '2', '3'], true) ? $layout : '1',
|
||||
'mobile_layout' => in_array($ml, ['center', 'left'], true) ? $ml : 'center',
|
||||
'mobile_align' => in_array($ma, ['top', 'left', 'right'], true) ? $ma : 'left',
|
||||
'nav_pay_vip' => !isset($settings['header_nav_pay_vip']) || !empty($settings['header_nav_pay_vip']),
|
||||
'nav_user_pay_vip' => !isset($settings['header_nav_user_pay_vip']) || !empty($settings['header_nav_user_pay_vip']),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -52,17 +59,23 @@ trait FacadeBulk {
|
||||
/**
|
||||
* Header publish button configuration.
|
||||
*
|
||||
* @return array{enabled:bool,text:string,radius:int,class:string}
|
||||
* @return array{enabled:bool,text:string,radius:int,class:string,types:string[]}
|
||||
*/
|
||||
public static function get_header_newposts_config(): array {
|
||||
$s = self::get_all();
|
||||
|
||||
$types = [];
|
||||
if (!empty($s['header_newposts_types']) && is_array($s['header_newposts_types'])) {
|
||||
$types = array_values(array_filter(array_map('sanitize_key', $s['header_newposts_types'])));
|
||||
}
|
||||
|
||||
return [
|
||||
// Default on like zibll nav_newposts when key unset.
|
||||
'enabled' => !isset($s['header_newposts_enabled']) || !empty($s['header_newposts_enabled']),
|
||||
'text' => trim((string) ($s['header_newposts_text'] ?? '<i class="fa fa-pencil"></i> 发布')),
|
||||
'radius' => max(0, min(30, (int) ($s['header_newposts_radius'] ?? 20))),
|
||||
'class' => sanitize_html_class((string) ($s['header_newposts_class'] ?? '')),
|
||||
'types' => $types,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user