Code.php in GraphQL 8.3
File
modules/graphql_core/src/Plugin/GraphQL/Fields/Routing/RedirectUrl/Code.php
View source
<?php
namespace Drupal\graphql_core\Plugin\GraphQL\Fields\Routing\RedirectUrl;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase;
use Drupal\redirect\Entity\Redirect;
use GraphQL\Type\Definition\ResolveInfo;
class Code extends FieldPluginBase {
public function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) {
if ($value instanceof Redirect) {
(yield $value
->getStatusCode());
}
}
}
Classes
Name |
Description |
Code |
Plugin annotation
@GraphQLField(
id = "redirect_url_code",
secure = true,
name = "code",
description = @Translation("The redirect code."),
type = "Int",
provider="redirect",
parents = {"RedirectUrl"}
) |