Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../src/Blocks
File: AssetsController.php
* @see https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/5052
[500] Fix | Delete
*/
[501] Fix | Delete
public function update_block_settings_dependencies() {
[502] Fix | Delete
$wp_scripts = wp_scripts();
[503] Fix | Delete
$known_packages = array( 'wc-settings', 'wc-blocks-checkout', 'wc-price-format' );
[504] Fix | Delete
[505] Fix | Delete
foreach ( $wp_scripts->registered as $handle => $script ) {
[506] Fix | Delete
// scripts that are loaded in the footer has extra->group = 1.
[507] Fix | Delete
if ( array_intersect( $known_packages, $script->deps ) && ! isset( $script->extra['group'] ) ) {
[508] Fix | Delete
// Append the script to footer.
[509] Fix | Delete
$wp_scripts->add_data( $handle, 'group', 1 );
[510] Fix | Delete
// Show a warning.
[511] Fix | Delete
$error_handle = 'wc-settings-dep-in-header';
[512] Fix | Delete
$used_deps = implode( ', ', array_intersect( $known_packages, $script->deps ) );
[513] Fix | Delete
$error_message = "Scripts that have a dependency on [$used_deps] must be loaded in the footer, {$handle} was registered to load in the header, but has been switched to load in the footer instead. See https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/5059";
[514] Fix | Delete
// phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter,WordPress.WP.EnqueuedResourceParameters.MissingVersion
[515] Fix | Delete
wp_register_script( $error_handle, '' );
[516] Fix | Delete
wp_enqueue_script( $error_handle );
[517] Fix | Delete
wp_add_inline_script(
[518] Fix | Delete
$error_handle,
[519] Fix | Delete
sprintf( 'console.warn( "%s" );', $error_message )
[520] Fix | Delete
);
[521] Fix | Delete
[522] Fix | Delete
}
[523] Fix | Delete
}
[524] Fix | Delete
}
[525] Fix | Delete
[526] Fix | Delete
/**
[527] Fix | Delete
* Enqueue the wc-entities script.
[528] Fix | Delete
*/
[529] Fix | Delete
public function enqueue_wc_entities() {
[530] Fix | Delete
wp_enqueue_script( 'wc-entities' );
[531] Fix | Delete
}
[532] Fix | Delete
}
[533] Fix | Delete
[534] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function