From 71faecaadce89c5d76e5fce8b69c63581e9522b1 Mon Sep 17 00:00:00 2001 From: Mark Pemburn Date: Fri, 22 Sep 2017 15:09:08 -0400 Subject: [PATCH 01/10] Make ACF compatible with users --- src/Field/BasicField.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Field/BasicField.php b/src/Field/BasicField.php index 5b39971..546c6e3 100644 --- a/src/Field/BasicField.php +++ b/src/Field/BasicField.php @@ -7,6 +7,9 @@ use Corcel\Model\Meta\PostMeta; use Corcel\Model\Term; use Corcel\Model\Meta\TermMeta; +use Corcel\Model\User; +use Corcel\Model\Meta\UserMeta; + /** * Class BasicField. @@ -63,6 +66,8 @@ public function __construct(Model $post) $this->postMeta = new PostMeta(); } elseif ($post instanceof Term) { $this->postMeta = new TermMeta(); + } elseif ($post instanceof User) { + $this->postMeta = new UserMeta(); } $this->postMeta->setConnection($post->getConnectionName()); @@ -151,6 +156,8 @@ public function getKeyName() return 'post_id'; } elseif ($this->post instanceof Term) { return 'term_id'; + } elseif ($this->post instanceof User) { + return 'user_id'; } } From e598b468df622545a432b78e0387e899f7262103 Mon Sep 17 00:00:00 2001 From: Mark Pemburn Date: Fri, 22 Sep 2017 15:13:42 -0400 Subject: [PATCH 02/10] Style error --- src/Field/BasicField.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Field/BasicField.php b/src/Field/BasicField.php index 546c6e3..bae10ae 100644 --- a/src/Field/BasicField.php +++ b/src/Field/BasicField.php @@ -10,7 +10,6 @@ use Corcel\Model\User; use Corcel\Model\Meta\UserMeta; - /** * Class BasicField. * From 6265880ebf2c8db8cde61d8968e3feaaeb09aee8 Mon Sep 17 00:00:00 2001 From: Omar Ahmed Date: Tue, 31 Oct 2017 21:39:21 +0000 Subject: [PATCH 03/10] add attachment id array key exists check --- src/Field/Gallery.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Field/Gallery.php b/src/Field/Gallery.php index b1bb286..a8a9a31 100644 --- a/src/Field/Gallery.php +++ b/src/Field/Gallery.php @@ -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; + } } } } From 8bafb7c4f376de5f278a5f655ab31a6a90ff2dd0 Mon Sep 17 00:00:00 2001 From: Omar Ahmed Date: Tue, 31 Oct 2017 21:42:47 +0000 Subject: [PATCH 04/10] maintain image order --- src/Field/Gallery.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Field/Gallery.php b/src/Field/Gallery.php index b1bb286..612f56b 100644 --- a/src/Field/Gallery.php +++ b/src/Field/Gallery.php @@ -30,7 +30,11 @@ public function process($field) { if ($ids = $this->fetchValue($field)) { $connection = $this->post->getConnectionName(); - $attachments = Post::on($connection)->whereIn('ID', $ids)->get(); + + $ids_ordered = implode(',', $ids); + + $attachments = Post::on($connection)->whereIn('ID', $ids) + ->orderByRaw("FIELD(ID, $ids_ordered)")->get(); $metaDataValues = $this->fetchMultipleMetadataValues($attachments); From 3801303295bc4d33e0637062208f5227347945b5 Mon Sep 17 00:00:00 2001 From: ivometz Date: Fri, 17 Nov 2017 10:50:09 +0100 Subject: [PATCH 05/10] Add missing link type in fieldfactory --- src/FieldFactory.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/FieldFactory.php b/src/FieldFactory.php index 13d881f..2709458 100644 --- a/src/FieldFactory.php +++ b/src/FieldFactory.php @@ -56,6 +56,7 @@ public static function make($name, Model $post, $type = null) case 'number': case 'email': case 'url': + case 'link': case 'password': case 'wysiwyg': case 'editor': From 94d9d8833a2576c43b7d8329ce941b38b0839236 Mon Sep 17 00:00:00 2001 From: Omar Ahmed Date: Sun, 28 Jan 2018 22:31:31 +0000 Subject: [PATCH 06/10] update test for image position --- tests/ContentFieldsTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ContentFieldsTest.php b/tests/ContentFieldsTest.php index 21995cb..c45ced5 100644 --- a/tests/ContentFieldsTest.php +++ b/tests/ContentFieldsTest.php @@ -97,8 +97,8 @@ public function testGalleryFieldValue() $this->assertTrue(strlen($image->url) > 0); } - // Testing the image in the 6th position - $image = $gallery->get()->get(6); + // Testing the image in the 0th position + $image = $gallery->get()->get(0); $this->assertEquals(1920, $image->width); $this->assertEquals(1080, $image->height); } From d7a3d1cea37ec41931223a124784ab48b63e8120 Mon Sep 17 00:00:00 2001 From: Marco Boom Date: Thu, 8 Feb 2018 08:16:29 +0100 Subject: [PATCH 07/10] Replace Corcel 1.0 model with the 2.* notation --- src/Field/Repeater.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Field/Repeater.php b/src/Field/Repeater.php index 356779e..0ad0ac0 100644 --- a/src/Field/Repeater.php +++ b/src/Field/Repeater.php @@ -76,7 +76,7 @@ protected function fetchPostsMeta($fieldName, $post) { $count = (int) $this->fetchValue($fieldName); - if ($this->postMeta instanceof \Corcel\TermMeta) { + if ($this->postMeta instanceof \Corcel\Model\Meta\TermMeta) { $builder = $this->postMeta->where('term_id', $post->term_id); } else { $builder = $this->postMeta->where('post_id', $post->ID); From 6429a0ecbb1b77ffea0bfa2329b9a48e2653a4dc Mon Sep 17 00:00:00 2001 From: Junior Grossi Date: Fri, 22 Mar 2019 14:37:49 -0300 Subject: [PATCH 08/10] Update StyleCI config --- .styleci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.styleci.yml b/.styleci.yml index 1ef97e9..9bc74a9 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -1,6 +1,4 @@ preset: psr2 -risky: false -linting: true finder: name: - "*.php" \ No newline at end of file From e20023bc3569c4c169c6f5ef5b29f41c2834e599 Mon Sep 17 00:00:00 2001 From: Junior Grossi Date: Fri, 22 Mar 2019 14:40:37 -0300 Subject: [PATCH 09/10] Add PHP versions up to 7.3 in TravisCI --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6d35bdb..2ab5902 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,9 @@ language: php php: - '5.6' - '7.0' + - '7.1' + - '7.2' + - '7.3' dist: trusty sudo: required addons: From 57aa31148e1db09cea77e9aaf1bdf9dacbe83d2d Mon Sep 17 00:00:00 2001 From: Junior Grossi Date: Fri, 22 Mar 2019 14:45:47 -0300 Subject: [PATCH 10/10] Move phpunit bin to the vendor one --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2ab5902..ffc5199 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,4 +23,4 @@ before_script: - composer install script: - mkdir -p build/logs - - phpunit \ No newline at end of file + - ./vendor/bin/phpunit \ No newline at end of file