diff --git a/src/Field/FlexibleContent.php b/src/Field/FlexibleContent.php index 2b13389..2fce43d 100644 --- a/src/Field/FlexibleContent.php +++ b/src/Field/FlexibleContent.php @@ -99,7 +99,7 @@ protected function fetchFields($fieldName, Builder $builder) $post = $this->post->ID != $meta->post_id ? $this->post->find($meta->post_id) : $this->post; $field = FieldFactory::make($meta->meta_key, $post); - if (!array_key_exists($id, $blocks)) { + if ($field === null || !array_key_exists($id, $blocks)) { continue; } diff --git a/src/Field/Image.php b/src/Field/Image.php index 5bca7b1..d5f1acd 100644 --- a/src/Field/Image.php +++ b/src/Field/Image.php @@ -85,6 +85,8 @@ public function get() */ protected function fillFields(Post $attachment) { + $this->attachment = $attachment; + $this->mime_type = $attachment->post_mime_type; $this->url = $attachment->guid; $this->description = $attachment->post_excerpt; diff --git a/src/Field/Repeater.php b/src/Field/Repeater.php index 0a2a459..6eb7ddb 100644 --- a/src/Field/Repeater.php +++ b/src/Field/Repeater.php @@ -74,7 +74,7 @@ protected function retrieveFieldName($metaKey, $fieldName, $id) */ protected function fetchPostsMeta($fieldName, Post $post) { - $count = $this->fetchValue($fieldName, $post); + $count = (int) $this->fetchValue($fieldName, $post); $builder = $this->postMeta->where('post_id', $post->ID); $builder->where(function ($query) use ($count, $fieldName) { foreach (range(0, $count - 1) as $i) {