You are here

public function UrlPath::resolve in GraphQL 8.4

Resolver.

Parameters

\Drupal\Core\Url $url:

\Drupal\Core\Cache\RefinableCacheableDependencyInterface $metadata:

Return value

string

File

src/Plugin/GraphQL/DataProducer/Routing/Url/UrlPath.php, line 38

Class

UrlPath
Generates a URL path from an URL object.

Namespace

Drupal\graphql\Plugin\GraphQL\DataProducer\Routing\Url

Code

public function resolve(Url $url, RefinableCacheableDependencyInterface $metadata) {
  $url = $url
    ->toString(TRUE);
  $metadata
    ->addCacheableDependency($url);
  return $url
    ->getGeneratedUrl();
}