Skip to content

Commit

Permalink
76888 - fix error 10 'foreach() argument must be of type array|object…
Browse files Browse the repository at this point in the history
…, null given'
  • Loading branch information
tyffany-robbes committed Nov 22, 2024
1 parent a48058e commit 99cc41d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions classes/addons/gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,20 @@ private function translate_block_attributes( array $attributes, string $block_na
break;
case 'core/gallery':
$image_ids = [];
foreach ( $attributes['ids'] as $image_id ) {
$local_id = BEA_CSF_Relations::get_object_for_any(
'attachment',
$emitter_blog_id,
$receiver_blog_id,
$image_id,
$image_id
);

if ( ! empty( $local_id ) ) {
$image_ids[] = $local_id;
if ( !empty( $attributes['ids'] ) ) {
foreach ( $attributes['ids'] as $image_id ) {
$local_id = BEA_CSF_Relations::get_object_for_any(
'attachment',
$emitter_blog_id,
$receiver_blog_id,
$image_id,
$image_id
);
}
}
if ( isset( $local_id ) && ! empty( $local_id ) ) {
$image_ids[] = $local_id;
}
$attributes['ids'] = $image_ids;
break;
case 'core/media-text':
Expand Down

0 comments on commit 99cc41d

Please sign in to comment.