InternalPath.php in GraphQL 8.3
File
modules/graphql_core/src/Plugin/GraphQL/Fields/Routing/InternalUrl/InternalPath.php
View source
<?php
namespace Drupal\graphql_core\Plugin\GraphQL\Fields\Routing\InternalUrl;
use Drupal\Core\Url;
use Drupal\graphql\GraphQL\Execution\ResolveContext;
use Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase;
use GraphQL\Type\Definition\ResolveInfo;
class InternalPath extends FieldPluginBase {
public function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) {
if ($value instanceof Url) {
(yield "/{$value->getInternalPath()}");
}
}
}