Skip to content

Commit

Permalink
GQL Type Updates + Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
samhibberd committed Jul 13, 2022
1 parent acf10d4 commit ff848e1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,23 @@ would output `<a href="/profile/USERNAME">Visit Profile</a>` which is the defaul

{{ entry.linkItField.user }}

**GraphQL**

Linkit supports querying subfields with GraphQl, the following fields are available:

myLinkitField {
label
type
typeHandle
available
link
url
text
target
element
}

Take a look at the Craft GraphQL explorer to have a play with the return values.

**A Note On Element Status**

Expand Down
7 changes: 7 additions & 0 deletions src/gql/types/LinkType.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ public static function getFieldDefinitions(): array
'name' => 'typeHandle',
'type' => Type::string(),
],
'available' => [
'name' => 'available',
'type' => Type::boolean(),
'resolve' => function($source, $arguments) {
return $source->isAvailable();
},
],
'link' => [
'name' => 'link',
'type' => Type::string(),
Expand Down

0 comments on commit ff848e1

Please sign in to comment.