WP_Script_Modules::get_import_map
Returns the import map array.
Method of the class: WP_Script_Modules{}
No Hooks.
Returns
Array. Array with an imports key mapping to an array of script module identifiers and their respective URLs, including the version query.
Usage
// private - for code of main (parent) class only $result = $this->get_import_map(): array;
Changelog
| Since 6.5.0 | Introduced. |
WP_Script_Modules::get_import_map() WP Script Modules::get import map code WP 6.9.1
private function get_import_map(): array {
$imports = array();
foreach ( array_keys( $this->get_dependencies( $this->queue ) ) as $id ) {
$src = $this->get_src( $id );
if ( '' !== $src ) {
$imports[ $id ] = $src;
}
}
return array( 'imports' => $imports );
}