Astra_Command_Palette::enqueue_command_palette_script()
Enqueue Command Palette integration script
Description
Return
(void)
Source
File: inc/core/class-astra-command-palette.php
public function enqueue_command_palette_script() {
/** @psalm-suppress InvalidGlobal */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
global $wp_version;
if ( version_compare( $wp_version, '6.3', '<' ) ) {
return;
}
/** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$dir_name = SCRIPT_DEBUG ? 'unminified' : 'minified';
/** @psalm-suppress RedundantCondition */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
$file_prefix = SCRIPT_DEBUG ? '' : '.min';
$script_path = ASTRA_THEME_DIR . 'assets/js/' . $dir_name . '/command-palette' . $file_prefix . '.js';
if ( ! file_exists( $script_path ) ) {
return;
}
/** @psalm-suppress InvalidArgument */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
wp_enqueue_script(
'astra-command-palette',
ASTRA_THEME_URI . 'assets/js/' . $dir_name . '/command-palette' . $file_prefix . '.js',
array( 'wp-data', 'wp-element', 'wp-commands', 'wp-dom-ready' ),
ASTRA_THEME_VERSION,
true
);
wp_localize_script(
'astra-command-palette',
'astraCommandPalette',
array(
'customizerUrl' => admin_url( 'customize.php' ),
'panels' => $this->get_customizer_panels(),
'iconUrl' => ASTRA_THEME_URI . 'inc/assets/images/astra-logo.svg',
)
);
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 4.12.0 | Introduced. |