Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/class-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 );
}
}

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions tests/wpunit/PostObjectFieldsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => '',
Expand Down
2 changes: 1 addition & 1 deletion wp-graphql-acf.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down