Query FunctionsField Default Value
Field Default Value
Included in the “Power Extensions” bundle
@default
directive, to set a value to null or empty fields.
Description
Directive @default
accepts two arguments:
value
: the default value, from any scalar type (string, boolean, integer, float or ID).condition
: if the field must be null or empty, via enum valuesIS_NULL
orIS_EMPTY
. By default it is null.
In the example below, when a post does not have a featured image, field featuredImage
returns null
:
By using @default
, we can then retrieve some default image: