Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

#254 - add back missing type declaration for options pages. #257

Merged
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
1 change: 1 addition & 0 deletions src/class-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
40 changes: 40 additions & 0 deletions tests/wpunit/LocationRulesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

/**
Expand Down Expand Up @@ -615,6 +642,16 @@ 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' );

acf_add_options_page(array(
'page_title' => 'Theme General Settings',
'menu_title' => 'Theme Settings',
Expand Down Expand Up @@ -649,11 +686,13 @@ public function testFieldGroupAssignedToAcfOptionsPageShowsInSchema() {
themeGeneralSettings {
settingsFieldsTest {
__typename
text
}
}
themeFooterSettings {
settingsFieldsTest {
__typename
text
}
}
}
Expand All @@ -666,6 +705,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' );

Expand Down
12 changes: 6 additions & 6 deletions vendor/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
),
),
);
Expand Down
12 changes: 6 additions & 6 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php return 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',
),
),
);