From f215390f7e767a57882ad22f96c29c8cac6309d6 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Fri, 5 Feb 2021 11:57:02 -0500 Subject: [PATCH] Add site and locale to entries --- src/GraphQL/Types/EntryInterface.php | 6 ++++++ tests/Feature/GraphQL/EntryTest.php | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/GraphQL/Types/EntryInterface.php b/src/GraphQL/Types/EntryInterface.php index 6eb00c462ad..875bcb3bc15 100644 --- a/src/GraphQL/Types/EntryInterface.php +++ b/src/GraphQL/Types/EntryInterface.php @@ -50,6 +50,12 @@ public function fields(): array ], 'date' => new DateField, 'last_modified' => new DateField, + 'locale' => [ + 'type' => GraphQL::nonNull(GraphQL::string()), + ], + 'site' => [ + 'type' => GraphQL::nonNull(GraphQL::type(SiteType::NAME)), + ], ]; foreach ($this->extraFields() as $field => $closure) { diff --git a/tests/Feature/GraphQL/EntryTest.php b/tests/Feature/GraphQL/EntryTest.php index bccdbabd826..1b806b1f224 100644 --- a/tests/Feature/GraphQL/EntryTest.php +++ b/tests/Feature/GraphQL/EntryTest.php @@ -44,6 +44,11 @@ public function it_queries_an_entry_by_id() title handle } + locale + site { + handle + name + } } } GQL; @@ -69,6 +74,11 @@ public function it_queries_an_entry_by_id() 'title' => 'Events', 'handle' => 'events', ], + 'locale' => 'en', + 'site' => [ + 'handle' => 'en', + 'name' => 'English', + ], ], ]]); }