You are here

class FileUrl in Open Social 10.3.x

Same name and namespace in other branches
  1. 10.2.x modules/custom/social_graphql/src/Plugin/GraphQL/DataProducer/Media/FileUrl.php \Drupal\social_graphql\Plugin\GraphQL\DataProducer\Media\FileUrl

Convert file URI to URL.

Plugin annotation


@DataProducer(
  id = "file_url",
  name = @Translation("File url"),
  description = @Translation("Convert uri to url."),
  produces = @ContextDefinition("string",
    label = @Translation("File url")
  ),
  consumes = {
    "uri" = @ContextDefinition("string",
      label = @Translation("File uri")
    ),
  }
)

Hierarchy

  • class \Drupal\social_graphql\Plugin\GraphQL\DataProducer\Media\FileUrl extends \Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase

Expanded class hierarchy of FileUrl

File

modules/custom/social_graphql/src/Plugin/GraphQL/DataProducer/Media/FileUrl.php, line 25

Namespace

Drupal\social_graphql\Plugin\GraphQL\DataProducer\Media
View source
class FileUrl extends DataProducerPluginBase {

  /**
   * Resolves the request to the requested values.
   *
   * @param string $uri
   *   The file URI.
   * @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface $metadata
   *   Cacheability metadata for this request.
   *
   * @return string
   *   The file URL.
   */
  public function resolve($uri, RefinableCacheableDependencyInterface $metadata) {
    return file_create_url($uri);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FileUrl::resolve public function Resolves the request to the requested values.