Skip to content

Commit

Permalink
chore: add null check
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Jan 11, 2024
1 parent e61ce27 commit 196ba22
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
17 changes: 9 additions & 8 deletions inc/core/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,19 @@ public function register_react_components() {
);
wp_set_script_translations( 'neve-components', 'neve' );

foreach ( $deps['chunks'] as $chunk_file ) {
if ( isset( $deps['chunks'] ) ) {
foreach ( $deps['chunks'] as $chunk_file ) {

$chunk_handle = 'neve-components-chunk-' . $chunk_file;
wp_register_script( $chunk_handle, trailingslashit( NEVE_ASSETS_URL ) . 'apps/components/build/' . $chunk_file, [], $deps['version'], true );
wp_enqueue_script( $chunk_handle );

if ( function_exists( 'wp_set_script_translations' ) ) {
wp_set_script_translations( $chunk_handle, 'neve' );
$chunk_handle = 'neve-components-chunk-' . $chunk_file;
wp_register_script( $chunk_handle, trailingslashit( NEVE_ASSETS_URL ) . 'apps/components/build/' . $chunk_file, [], $deps['version'], true );
wp_enqueue_script( $chunk_handle );

if ( function_exists( 'wp_set_script_translations' ) ) {
wp_set_script_translations( $chunk_handle, 'neve' );
}
}
}


wp_register_style( 'neve-components', trailingslashit( NEVE_ASSETS_URL ) . 'apps/components/build/style-components.css', [ 'wp-components' ], $deps['version'] );
wp_add_inline_style( 'neve-components', Dynamic_Css::get_root_css() );
}
Expand Down
18 changes: 10 additions & 8 deletions inc/customizer/loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,17 @@ public function enqueue_customizer_controls() {
wp_register_style( 'react-controls', $bundle_path . 'style-controls.css', [ 'neve-components' ], $dependencies['version'] );
wp_style_add_data( 'react-controls', 'rtl', 'replace' );
wp_enqueue_style( 'react-controls' );

foreach ( $dependencies['chunks'] as $chunk_file ) {

if ( isset( $dependencies['chunks'] ) ) {
foreach ( $dependencies['chunks'] as $chunk_file ) {

$chunk_handle = 'neve-customizer-chunk-' . $chunk_file;
wp_register_script( $chunk_handle, $bundle_path . $chunk_file, [], $dependencies['version'], true );
wp_enqueue_script( $chunk_handle );

if ( function_exists( 'wp_set_script_translations' ) ) {
wp_set_script_translations( $chunk_handle, 'neve' );
$chunk_handle = 'neve-customizer-chunk-' . $chunk_file;
wp_register_script( $chunk_handle, $bundle_path . $chunk_file, [], $dependencies['version'], true );
wp_enqueue_script( $chunk_handle );

if ( function_exists( 'wp_set_script_translations' ) ) {
wp_set_script_translations( $chunk_handle, 'neve' );
}
}
}

Expand Down

0 comments on commit 196ba22

Please sign in to comment.