Skip to content

Commit cd5942f

Browse files
committed
Prevent global fields from being added twice.
1 parent 95deb76 commit cd5942f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Type/Object/TemplatedPageType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Youshido\GraphQL\Type\Object\AbstractObjectType;
66
use ProcessWire\Template;
7+
use ProcessWire\Field;
78
use ProcessWire\GraphQL\Type\InterfaceType\PageInterfaceType;
89
use ProcessWire\GraphQL\Settings;
910

@@ -40,6 +41,7 @@ public function build($config)
4041
$config->applyInterface(new PageInterfaceType());
4142
foreach ($this->template->fields as $field) {
4243
if (!$legalFields->has($field)) continue;
44+
if ($field->flags & Field::flagGlobal) continue; // global fields are already added via PageTypeInterface
4345
$className = "\\ProcessWire\\GraphQL\\Field\\Page\\Fieldtype\\" . $field->type->className();
4446
if (!class_exists($className)) continue;
4547
$config->addField(new $className($field));

0 commit comments

Comments
 (0)