Skip to content

Commit

Permalink
Merge pull request #55 from omzy83/ACF-51
Browse files Browse the repository at this point in the history
add attachment id array key exists check
  • Loading branch information
jgrossi authored Dec 1, 2017
2 parents cb223f9 + 6265880 commit 6ce0d7f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Field/Gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ public function process($field)
$metaDataValues = $this->fetchMultipleMetadataValues($attachments);

foreach ($attachments as $attachment) {
$image = new Image($this->post);
$image->fillFields($attachment);
$image->fillMetadataFields($metaDataValues[$attachment->ID]);
$this->images[] = $image;
if (array_key_exists($attachment->ID, $metaDataValues)) {
$image = new Image($this->post);
$image->fillFields($attachment);
$image->fillMetadataFields($metaDataValues[$attachment->ID]);
$this->images[] = $image;
}
}
}
}
Expand Down

0 comments on commit 6ce0d7f

Please sign in to comment.