Skip to content
Snippets Groups Projects

Expose managed files on GraphQL 4.

10 files
+ 124
192
Compare changes
  • Side-by-side
  • Inline
Files
10
<?php
declare(strict_types=1);
namespace Drupal\graphql_webform\Plugin\GraphQL\Fields\Element;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase;
use GraphQL\Type\Definition\ResolveInfo;
/**
* Retrieve the form element description.
*
* @GraphQLField(
* secure = true,
* parents = {
* "WebformElementTextBase",
* "WebformElementOptionsBase",
* "WebformElementManagedFileBase",
* "WebformElementDateBase",
* "WebformElementComposite",
* "WebformElementNumber",
* "WebformElementCheckbox",
* },
* id = "webform_element_description",
* name = "description",
* type = "String",
* )
*/
class WebformElementDescription extends FieldPluginBase {
/**
* {@inheritdoc}
*/
public function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) {
if (isset($value['#description'])) {
yield $value['#description'];
}
}
}
Loading