Automattic\WooCommerce\Blocks
AssetsController::get_script_dependency_src_array
Get the src of all script dependencies (handles).
Method of the class: AssetsController{}
No Hooks.
Returns
String[]
. Array of src strings.
Usage
// private - for code of main (parent) class only $result = $this->get_script_dependency_src_array( $dependencies );
- $dependencies(array) (required)
- Array of dependency handles.
AssetsController::get_script_dependency_src_array() AssetsController::get script dependency src array code WC 9.9.3
private function get_script_dependency_src_array( array $dependencies ) { $wp_scripts = wp_scripts(); return array_reduce( $dependencies, function ( $src, $handle ) use ( $wp_scripts ) { if ( isset( $wp_scripts->registered[ $handle ] ) ) { $src[] = esc_url( add_query_arg( 'ver', $wp_scripts->registered[ $handle ]->ver, $this->get_absolute_url( $wp_scripts->registered[ $handle ]->src ) ) ); $src = array_merge( $src, $this->get_script_dependency_src_array( $wp_scripts->registered[ $handle ]->deps ) ); } return $src; }, array() ); }