Gql

Type
Class
Namespace
craft\helpers
Inherits
craft\helpers\Gql
Since
3.3.0

Class Gql

View source

# Public Methods

Method Description
applyDirectives() Apply directives (if any) to a resolved value according to source and resolve info.
canQueryAssets() Return true if active schema can query assets.
canQueryCategories() Return true if active schema can query categories.
canQueryEntries() Return true if active schema can query entries.
canQueryGlobalSets() Return true if active schema can query global sets.
canQueryTags() Return true if active schema can query tags.
canQueryUsers() Return true if active schema can query users.
canSchema() Returns true if the active schema can perform the action on the scope.
createFullAccessSchema() Creates a temporary schema with full access to the GraphQL API.
extractAllowedEntitiesFromSchema() Extracts all the allowed entities from the active schema for the action.
getUnionType() Get (and create if needed) a union type by name, included types and a resolver funcion.
isSchemaAwareOf() Returns true if the active schema is aware of the provided scope(s).

# applyDirectives()

Apply directives (if any) to a resolved value according to source and resolve info.

View source

Arguments

  • $source
  • $resolveInfo (\GraphQL\Type\Definition\ResolveInfo)
  • $value

Returns

mixed

# canQueryAssets()

Return true if active schema can query assets.

View source

Returns

boolean

# canQueryCategories()

Return true if active schema can query categories.

View source

Returns

boolean

# canQueryEntries()

Return true if active schema can query entries.

View source

Returns

boolean

# canQueryGlobalSets()

Return true if active schema can query global sets.

View source

Returns

boolean

# canQueryTags()

Return true if active schema can query tags.

View source

Returns

boolean

# canQueryUsers()

Return true if active schema can query users.

View source

Returns

boolean

# canSchema()

Returns true if the active schema can perform the action on the scope.

View source

Arguments

  • $scope (string) – The scope to check.
  • $action (string) – The action. Defaults to "read"

Returns

boolean

Throws

# createFullAccessSchema()

Since
3.4.0

Creates a temporary schema with full access to the GraphQL API.

View source

Returns

craft\models\GqlSchema

# extractAllowedEntitiesFromSchema()

Extracts all the allowed entities from the active schema for the action.

View source

Arguments

  • $action (string) – The action for which the entities should be extracted. Defaults to "read"

Returns

array

# getUnionType()

Get (and create if needed) a union type by name, included types and a resolver funcion.

View source

Arguments

  • $typeName (string) – The union type name.
  • $includedTypes (array) – The type the union should include
  • $resolveFunction (callable) – The resolver function to use to resolve a specific type.

Returns

mixed

# isSchemaAwareOf()

Returns true if the active schema is aware of the provided scope(s).

View source

Arguments

Returns

boolean