diff --git a/src/class-config.php b/src/class-config.php index f675fc0..773b7f1 100644 --- a/src/class-config.php +++ b/src/class-config.php @@ -446,7 +446,7 @@ protected function register_graphql_field( $type_name, $field_name, $config ) { $field_config['type'] = 'String'; break; case 'range': - $field_config['type'] = 'Integer'; + $field_config['type'] = 'Float'; break; case 'number': $field_config['type'] = 'Float'; @@ -1020,7 +1020,7 @@ protected function register_graphql_field( $type_name, $field_name, $config ) { $layout['parent'] = $acf_field; $layout['show_in_graphql'] = isset( $acf_field['show_in_graphql'] ) ? (bool) $acf_field['show_in_graphql'] : true; - $this->add_field_group_fields( $layout, $flex_field_layout_name ); + $this->add_field_group_fields( $layout, $flex_field_layout_name, true ); } } @@ -1058,8 +1058,9 @@ protected function register_graphql_field( $type_name, $field_name, $config ) { * * @param array $field_group The group to add to the Schema. * @param string $type_name The Type name in the GraphQL Schema to add fields to. + * @param bool $layout Whether or not these fields are part of a Flex Content layout. */ - protected function add_field_group_fields( $field_group, $type_name ) { + protected function add_field_group_fields( $field_group, $type_name, $layout = false ) { /** * If the field group has the show_in_graphql setting configured, respect it's setting @@ -1078,7 +1079,7 @@ protected function add_field_group_fields( $field_group, $type_name ) { /** * Get the fields in the group. */ - $acf_fields = ! empty( $field_group['sub_fields'] ) ? $field_group['sub_fields'] : acf_get_fields( $field_group ); + $acf_fields = ! empty( $field_group['sub_fields'] ) || $layout ? $field_group['sub_fields'] : acf_get_fields( $field_group ); /** * If there are no fields, bail diff --git a/tests/wpunit/PostObjectFieldsTest.php b/tests/wpunit/PostObjectFieldsTest.php index 1acfe39..388cb9c 100644 --- a/tests/wpunit/PostObjectFieldsTest.php +++ b/tests/wpunit/PostObjectFieldsTest.php @@ -2269,6 +2269,15 @@ protected function register_fields() { 'min' => '', 'max' => '', ), + 'layout_5d74257693147' => array( + 'key' => 'layout_5d74257693147', + 'name' => 'group_3', + 'label' => 'Group Three', + 'display' => 'block', + 'sub_fields' => array(), + 'min' => '', + 'max' => '', + ), ), 'button_label' => 'Add Row', 'min' => '', diff --git a/wp-graphql-acf.php b/wp-graphql-acf.php index 2f07b8c..810f4d9 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.3.5 + * Version: 0.4.0 * Requires PHP: 7.0 * GitHub Plugin URI: https://github.com/afragen/github-updater *