Astra_Ext_Nav_Menu_Markup::register_mega_menu_script()
Register Script for Mega menu.
Description
Source
File: addons/nav-menu/classes/class-astra-ext-nav-menu-markup.php
public function register_mega_menu_script() {
$path = ASTRA_ADDON_EXT_NAV_MENU_URL . 'react/build/index.js';
if ( is_rtl() ) {
$font_icon_picker_css_file = 'font-icon-picker-rtl';
} else {
$font_icon_picker_css_file = 'font-icon-picker';
}
wp_enqueue_style( 'ahfb-customizer-color-picker-style', ASTRA_THEME_URI . 'inc/assets/css/' . $font_icon_picker_css_file . '.css', array(), ASTRA_EXT_VER );
wp_enqueue_style( 'astra-customizer-control-css', get_site_url() . '/wp-includes/css/dist/components/style.css', array(), ASTRA_EXT_VER );
wp_register_script(
'astra-mega-menu',
$path,
array( 'wp-edit-post', 'wp-i18n', 'wp-element' ),
ASTRA_EXT_VER,
true
);
$widget_obj = Astra_Ext_Nav_Widget_Support::get_instance();
wp_localize_script(
'astra-mega-menu',
'AstraBuilderMegaMenu',
array(
'isWP_5_9' => astra_wp_version_compare( '5.8.99', '>=' ),
'nonce' => wp_create_nonce( 'wp_rest' ),
'nonceWidget' => wp_create_nonce( 'wp_widget_nonce' ),
'globalColorPalette' => astra_get_option( 'global-color-palette' ),
'globalPaletteStylePrefix' => Astra_Global_Palette::get_css_variable_prefix(),
'globalPaletteLabels' => Astra_Global_Palette::get_palette_labels(),
'widgets' => $widget_obj->get_widget_list(),
'savingButtonText' => array(
'initial' => __( 'Save Changes', 'astra-addon' ),
'saving' => __( 'Saving...', 'astra-addon' ),
'saved' => __( 'Saved', 'astra-addon' ),
'error' => __( 'Error Saving', 'astra-addon' ),
),
'oldMegaMenuUrl' => admin_url( 'customize.php?autofocus[control]=' . ASTRA_THEME_SETTINGS . '[primary-header-megamenu-heading-color]' ),
'isHeaderFooterBuilderActive' => astra_addon_builder_helper()->is_header_footer_builder_active,
'newMegaMenuUrl' => admin_url( 'customize.php?autofocus[panel]=panel-header-builder-group' ),
)
);
wp_enqueue_script( 'astra-mega-menu' );
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 4.0.0 | Introduced. |