Skip to content

Commit cf86f0c

Browse files
authored
Make sure FieldtypeCheckbox returns boolean
1 parent e2cc451 commit cf86f0c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Field/Page/Fieldtype/FieldtypeCheckbox.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@
44

55
use Youshido\GraphQL\Type\Scalar\BooleanType;
66
use ProcessWire\GraphQL\Field\Page\Fieldtype\AbstractFieldtype;
7+
use Youshido\GraphQL\Execution\ResolveInfo;
78

89
class FieldtypeCheckbox extends AbstractFieldtype {
910

1011
public function getDefaultType()
1112
{
1213
return new BooleanType();
1314
}
15+
16+
public function resolve($value, array $args, ResolveInfo $info)
17+
{
18+
$fieldName = $this->field->name;
19+
return (boolean) $value->$fieldName;
20+
}
1421

15-
}
22+
}

0 commit comments

Comments
 (0)