From 58191ca7cba893d0d791bc574c74e0ddef534723 Mon Sep 17 00:00:00 2001 From: Nick Barrett Date: Wed, 22 Mar 2017 14:43:48 +0800 Subject: [PATCH 1/2] add clone field support --- src/Field/BasicField.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Field/BasicField.php b/src/Field/BasicField.php index 1888160..b338f31 100644 --- a/src/Field/BasicField.php +++ b/src/Field/BasicField.php @@ -115,6 +115,12 @@ public function fetchFieldKey($fieldName) */ public function fetchFieldType($fieldKey) { + // Check if this a clone field. If it is, return the field type of it's clone. + $fieldKeyIds = explode('_', $fieldKey); + if (count($fieldKeyIds) == 4) { + $fieldKey = 'field_' . $fieldKeyIds[3]; + } + $post = $this->post->orWhere(function ($query) use ($fieldKey) { $query->where('post_name', $fieldKey); $query->where('post_type', 'acf-field'); From 466135b4ec9ad94d867a43f74b3c3f1a61a47d42 Mon Sep 17 00:00:00 2001 From: Nick Barrett Date: Wed, 22 Mar 2017 14:50:51 +0800 Subject: [PATCH 2/2] comment typo --- src/Field/BasicField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Field/BasicField.php b/src/Field/BasicField.php index b338f31..1723d42 100644 --- a/src/Field/BasicField.php +++ b/src/Field/BasicField.php @@ -115,7 +115,7 @@ public function fetchFieldKey($fieldName) */ public function fetchFieldType($fieldKey) { - // Check if this a clone field. If it is, return the field type of it's clone. + // Check if this a clone field. If it is, return the field type of its clone. $fieldKeyIds = explode('_', $fieldKey); if (count($fieldKeyIds) == 4) { $fieldKey = 'field_' . $fieldKeyIds[3];