Skip to content
Snippets Groups Projects
Commit 82cb1a43 authored by Pieter Frenssen's avatar Pieter Frenssen
Browse files

Issue #3426802 by pfrenssen: Only expose the element type once

parent 493445fe
Branches
Tags
2 merge requests!513506037: Add help elements.,!20Only expose the type once.
Pipeline #115416 passed with warnings
......@@ -41,8 +41,10 @@ composer require drupal/graphql_webform
description
elements {
... on WebformElement {
id
type
metadata {
key
type
}
}
... on WebformElementWebformActions {
submitLabel
......
......@@ -158,9 +158,6 @@ class WebformExtension extends SdlSchemaExtensionPluginBase {
'required' => 'boolean',
'requiredError' => 'string',
],
'WebformElement' => [
'type' => 'string',
],
'WebformElementMarkupBase' => [
'markup' => 'string',
],
......
......@@ -184,11 +184,10 @@ class WebformSchemaBuilder {
* Returns the definition for a GraphQL element.
*
* @return array
* The element definition, containing the type and metadata fields.
* The element definition, containing the metadata field.
*/
protected function getElementDefinition(): array {
return [
'type' => Type::string(),
'metadata' => fn () => $this->types['WebformElementMetadata'],
];
}
......
......@@ -7,7 +7,6 @@ fragment webformElementOption on WebformElementOption {
fragment webformElementRadios on WebformElementRadios {
__typename
type
metadata {
key
type
......
fragment webformElementTextarea on WebformElementTextarea {
__typename
type
metadata {
key
type
......
fragment webformElementTextField on WebformElementTextfield {
__typename
type
metadata {
key
type
......
fragment webformElement on WebformElementUnexposed {
__typename
type
metadata {
__typename
key
......
......@@ -38,7 +38,6 @@ class RadiosTest extends GraphQLWebformKernelTestBase {
'description' => 'Broadcasts from Peru since 1964',
],
],
'type' => 'radios',
'metadata' => [
'key' => 'radios',
'type' => 'radios',
......
......@@ -24,7 +24,6 @@ class TextAreaTest extends GraphQLWebformKernelTestBase {
'elements' => [
4 => [
'__typename' => 'WebformElementTextarea',
'type' => 'textarea',
'metadata' => [
'key' => 'textarea',
'type' => 'textarea',
......
......@@ -24,7 +24,6 @@ class TextFieldTest extends GraphQLWebformKernelTestBase {
'elements' => [
0 => [
'__typename' => 'WebformElementTextfield',
'type' => 'textfield',
'metadata' => [
'key' => 'required_text_field',
'type' => 'textfield',
......@@ -45,7 +44,6 @@ class TextFieldTest extends GraphQLWebformKernelTestBase {
],
1 => [
'__typename' => 'WebformElementTextfield',
'type' => 'textfield',
'metadata' => [
'key' => 'optional_text_field',
'type' => 'textfield',
......
......@@ -19,7 +19,7 @@ class UnexposedElementTest extends GraphQLWebformKernelTestBase {
/**
* Tests the fallback for unexposed element types.
*/
public function testFallbackType(): void {
public function testUnexposedElementType(): void {
$query = $this->getQueryFromFile('unexposed.gql');
$this->assertResults($query, ['id' => 'graphql_webform_test_form'], [
'form' => [
......@@ -27,7 +27,6 @@ class UnexposedElementTest extends GraphQLWebformKernelTestBase {
'elements' => [
3 => [
'__typename' => 'WebformElementUnexposed',
'type' => 'webform_nonexisting_type',
'metadata' => [
'key' => 'unsupported_field',
'type' => 'webform_nonexisting_type',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment