From dc5e83d190211baf88978a905ff44a9122fdaff8 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Wed, 28 Apr 2021 10:20:51 -0600 Subject: [PATCH 1/4] #254 - add back missing type declaration for options pages. See: https://github.com/wp-graphql/wp-graphql-acf/pull/250/files?file-filters%5B%5D=.php&file-filters%5B%5D=.woff2&file-filters%5B%5D=.xml&file-filters%5B%5D=.yml&file-filters%5B%5D=dotfile#diff-a561f3a494f34edd4c3f2e83c25c8d4a9dc217eeeaed4385c735040450230ac0L1765 --- src/class-config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/class-config.php b/src/class-config.php index eeaa1a3..927f2b3 100644 --- a/src/class-config.php +++ b/src/class-config.php @@ -270,6 +270,7 @@ protected function add_options_pages_to_schema() { $field_name = Utils::format_field_name( $type_name ); + $options_page['type'] = 'options_page'; $this->type_registry->register_field( 'RootQuery', $field_name, From 00521e937823f495c1cdb9c7c21252c88c85e953 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Wed, 28 Apr 2021 13:38:16 -0600 Subject: [PATCH 2/4] - Update Options test to query for a field --- tests/wpunit/LocationRulesTest.php | 42 +++++++++++++++++++++++++++ vendor/composer/InstalledVersions.php | 12 ++++---- vendor/composer/installed.php | 12 ++++---- 3 files changed, 54 insertions(+), 12 deletions(-) diff --git a/tests/wpunit/LocationRulesTest.php b/tests/wpunit/LocationRulesTest.php index 5b1f155..2eb6081 100644 --- a/tests/wpunit/LocationRulesTest.php +++ b/tests/wpunit/LocationRulesTest.php @@ -67,6 +67,33 @@ public function register_acf_field_group( $config = [] ) { } + public function register_acf_field( $config = [] ) { + + $defaults = [ + 'parent' => $this->group_key, + 'key' => 'field_5d7812fd123', + 'label' => 'Text', + 'name' => 'text', + 'type' => 'text', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => 0, + 'wrapper' => array( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'show_in_graphql' => 1, + 'default_value' => '', + 'placeholder' => '', + 'prepend' => '', + 'append' => '', + 'maxlength' => '', + ]; + + acf_add_local_field( array_merge( $defaults, $config ) ); + } + public function testFieldGroupAssignedToPostTypeWithoutGraphqlTypesFieldShowsInSchema() { /** @@ -615,6 +642,18 @@ public function testFieldGroupAssignedToAcfOptionsPageShowsInSchema() { 'graphql_field_name' => 'settingsFieldsTest', ]); + $this->register_acf_field([ + 'parent' => 'settingsFieldsTest', + 'name' => 'text', + 'key' => 'settingsFieldTextField' + ]); + + $expected = 'this is a test value for the settings field'; + + update_field( 'settingsFieldTextField', $expected, 'option' ); + + update_option( 'option_text', $expected, false ); + acf_add_options_page(array( 'page_title' => 'Theme General Settings', 'menu_title' => 'Theme Settings', @@ -649,11 +688,13 @@ public function testFieldGroupAssignedToAcfOptionsPageShowsInSchema() { themeGeneralSettings { settingsFieldsTest { __typename + text } } themeFooterSettings { settingsFieldsTest { __typename + text } } } @@ -666,6 +707,7 @@ public function testFieldGroupAssignedToAcfOptionsPageShowsInSchema() { codecept_debug( $actual ); $this->assertArrayNotHasKey( 'errors', $actual ); + $this->assertSame( $expected, $actual['data']['themeGeneralSettings']['settingsFieldsTest']['text'] ); acf_remove_local_field_group( 'settingsFieldsTest' ); diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index bb0f57a..6b5a555 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -25,24 +25,24 @@ class InstalledVersions private static $installed = array ( 'root' => array ( - 'pretty_version' => 'dev-develop', - 'version' => 'dev-develop', + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', 'aliases' => array ( ), - 'reference' => '1bad7d6d5214448f8d27bbcd908b24d6552667cb', + 'reference' => 'dc5e83d190211baf88978a905ff44a9122fdaff8', 'name' => 'wp-graphql/wp-graphql-acf', ), 'versions' => array ( 'wp-graphql/wp-graphql-acf' => array ( - 'pretty_version' => 'dev-develop', - 'version' => 'dev-develop', + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', 'aliases' => array ( ), - 'reference' => '1bad7d6d5214448f8d27bbcd908b24d6552667cb', + 'reference' => 'dc5e83d190211baf88978a905ff44a9122fdaff8', ), ), ); diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 6ae1e93..933c2e4 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,24 +1,24 @@ array ( - 'pretty_version' => 'dev-develop', - 'version' => 'dev-develop', + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', 'aliases' => array ( ), - 'reference' => '1bad7d6d5214448f8d27bbcd908b24d6552667cb', + 'reference' => 'dc5e83d190211baf88978a905ff44a9122fdaff8', 'name' => 'wp-graphql/wp-graphql-acf', ), 'versions' => array ( 'wp-graphql/wp-graphql-acf' => array ( - 'pretty_version' => 'dev-develop', - 'version' => 'dev-develop', + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', 'aliases' => array ( ), - 'reference' => '1bad7d6d5214448f8d27bbcd908b24d6552667cb', + 'reference' => 'dc5e83d190211baf88978a905ff44a9122fdaff8', ), ), ); From ba76d777ff4a0675a330407d6bfcfe5809011a68 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Wed, 28 Apr 2021 13:44:25 -0600 Subject: [PATCH 3/4] - remove unused update_option call --- tests/wpunit/LocationRulesTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/wpunit/LocationRulesTest.php b/tests/wpunit/LocationRulesTest.php index 2eb6081..3a3b2fc 100644 --- a/tests/wpunit/LocationRulesTest.php +++ b/tests/wpunit/LocationRulesTest.php @@ -652,8 +652,6 @@ public function testFieldGroupAssignedToAcfOptionsPageShowsInSchema() { update_field( 'settingsFieldTextField', $expected, 'option' ); - update_option( 'option_text', $expected, false ); - acf_add_options_page(array( 'page_title' => 'Theme General Settings', 'menu_title' => 'Theme Settings', From 0491bff10cf3395040eabdd239f0db3ccd2f3e3e Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Wed, 28 Apr 2021 13:57:14 -0600 Subject: [PATCH 4/4] - Update version number for release --- readme.txt | 2 +- wp-graphql-acf.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.txt b/readme.txt index 0b68998..bb481bf 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://wpgraphql.com/acf Tags: WPGraphQL, GraphQL, API, Advanced Custom Fields, ACF Requires at least: 5.0 Tested up to: 5.1.1 -Stable tag: 0.5.0 +Stable tag: 0.5.2 License: GPL-3 License URI: https://www.gnu.org/licenses/gpl-3.0.html diff --git a/wp-graphql-acf.php b/wp-graphql-acf.php index 76daa7b..7275d55 100644 --- a/wp-graphql-acf.php +++ b/wp-graphql-acf.php @@ -7,7 +7,7 @@ * Author URI: https://www.wpgraphql.com * Text Domain: wp-graphql-acf * Domain Path: /languages - * Version: 0.5.0 + * Version: 0.5.2 * Requires PHP: 7.0 * GitHub Plugin URI: https://github.com/wp-graphql/wp-graphql-acf * @@ -26,7 +26,7 @@ * Define constants */ const WPGRAPHQL_REQUIRED_MIN_VERSION = '0.4.0'; -const WPGRAPHQL_ACF_VERSION = '0.5.0'; +const WPGRAPHQL_ACF_VERSION = '0.5.2'; /** * Initialize the plugin