Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
graphql_webform
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
graphql_webform
Merge requests
!13
Support checkboxes in GraphQL 4.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Support checkboxes in GraphQL 4.
issue/graphql_webform-3424602:3424602-graphql4-checkboxes
into
2.x
Overview
0
Commits
10
Pipelines
9
Changes
19
Merged
Pieter Frenssen
requested to merge
issue/graphql_webform-3424602:3424602-graphql4-checkboxes
into
2.x
1 year ago
Overview
0
Commits
10
Pipelines
9
Changes
19
Expand
Closes
#3424602
0
0
Merge request reports
Compare
2.x
version 8
fee40d2d
1 year ago
version 7
0a2f89e8
1 year ago
version 6
07eb1068
1 year ago
version 5
a76c46de
1 year ago
version 4
51e62dba
1 year ago
version 3
38ae8304
1 year ago
version 2
fc58586b
1 year ago
version 1
c498b0f0
1 year ago
2.x (base)
and
latest version
latest version
fee40d2d
10 commits,
1 year ago
version 8
fee40d2d
10 commits,
1 year ago
version 7
0a2f89e8
9 commits,
1 year ago
version 6
07eb1068
6 commits,
1 year ago
version 5
a76c46de
5 commits,
1 year ago
version 4
51e62dba
4 commits,
1 year ago
version 3
38ae8304
3 commits,
1 year ago
version 2
fc58586b
2 commits,
1 year ago
version 1
c498b0f0
1 commit,
1 year ago
19 files
+
685
−
238
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
19
Search (e.g. *.vue) (Ctrl+P)
d10/src/Plugin/GraphQL/DataProducer/WebformItems.php deleted
100644 → 0
+
0
−
51
Options
<?php
namespace
Drupal\graphql_webform\Plugin\GraphQL\DataProducer
;
use
Drupal\Core\Render\Element
;
use
Drupal\graphql\GraphQL\Execution\FieldContext
;
use
Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase
;
use
Drupal\webform\WebformInterface
;
/**
* Return the webform items.
*
* @DataProducer(
* id = "webform_items",
* name = @Translation("Webform Items"),
* description = @Translation("Returns the webforms items (elements)."),
* produces = @ContextDefinition("any",
* label = @Translation("Webform Items"),
* required = FALSE
* ),
* consumes = {
* "webform" = @ContextDefinition("entity:webform",
* label = @Translation("Webform")
* ),
* "form" = @ContextDefinition("any",
* label = @Translation("Webform Submission Form")
* )
* }
* )
*/
class
WebformItems
extends
DataProducerPluginBase
{
/**
* Resolver.
*/
public
function
resolve
(
WebformInterface
$webform
,
array
$form
,
FieldContext
$field
)
{
$elements
=
empty
(
$form
[
'elements'
])
?
$form
:
$form
[
'elements'
];
$childKeys
=
Element
::
children
(
$elements
,
TRUE
);
$data
=
$webform
->
getElementsDecodedAndFlattened
(
'view'
);
$items
=
[];
foreach
(
$childKeys
as
$key
)
{
$element
=
$elements
[
$key
]
??
NULL
;
if
(
$element
)
{
$element
[
'#graphql_element_decoded'
]
=
$data
[
$key
]
??
NULL
;
$items
[]
=
$element
;
}
}
return
$items
;
}
}
Loading