Conditional Field Manipulation

“Personal”
1 domain
“Professional”
5 domains
“Agency”
25 domains

$9.99

$19.99

$39.99

Buying the extension gives you a license for 1 year (renewable every year), that includes support and access to all extension updates. Prices are in USD.

🛍️ Buy “Conditional Field Manipulation” Extension


Addition of meta directives @if and @unless to the GraphQL schema, to conditionally execute a nested directive on the field.

@if permalink

@if executes its nested directives only if a condition has value true.

In this query, users "Leo" and "Peter" get their names converted to upper case, since they are in the "special user" array, while "Martin" does not:

query {
users {
name
@passOnwards(as: "userName")
@applyField(
name: "_inArray"
arguments: {
value: $userName
array: ["Leo", "John", "Peter"]
}
passOnwardsAs: "isSpecialUser"
)
@if(
condition: $isSpecialUser
)
@strUpperCase
}
}

...producing:

{
"data": {
"users": [
{
"name": "LEO"
},
{
"name": "Martin"
},
{
"name": "PETER"
}
]
}
}

@unless permalink

Similar to @if, but it executes the nested directives when the condition is false.

In this query, it is user "Martin" who gets the name converted to upper case, while the other ones do not:

query {
users {
name
@passOnwards(as: "userName")
@applyField(
name: "_inArray"
arguments: {
value: $userName
array: ["Leo", "John", "Peter"]
}
passOnwardsAs: "isSpecialUser"
)
@unless(
condition: $isSpecialUser
)
@strUpperCase
}
}

...producing:

{
"data": {
"users": [
{
"name": "Leo"
},
{
"name": "MARTIN"
},
{
"name": "Peter"
}
]
}
}

Bundles including extension permalink

Recipes using extension permalink


🛍️ Buy “Conditional Field Manipulation” Extension