class OEmbedIframeController implements ContainerInjectionInterface (View source)

internal  This is an internal part of the media system in Drupal core and may be subject to change in minor releases. This class should not be instantiated or extended by external code.
 

Controller which renders an oEmbed resource in a bare page (without blocks).

This controller is meant to render untrusted third-party HTML returned by an oEmbed provider in an iframe, so as to mitigate the potential dangers of of displaying third-party markup (i.e., XSS). The HTML returned by this controller should not be trusted, and should never be displayed outside of an iframe.

Properties

protected ResourceFetcherInterface $resourceFetcher

The oEmbed resource fetcher service.

protected UrlResolverInterface $urlResolver

The oEmbed URL resolver service.

protected RendererInterface $renderer

The renderer service.

protected LoggerInterface $logger

The logger channel.

protected IFrameUrlHelper $iFrameUrlHelper

The iFrame URL helper service.

Methods

__construct(ResourceFetcherInterface $resource_fetcher, UrlResolverInterface $url_resolver, RendererInterface $renderer, LoggerInterface $logger, IFrameUrlHelper $iframe_url_helper)

Constructs an OEmbedIframeController instance.

static 
create(ContainerInterface $container)

Instantiates a new instance of this class.

Response
render(Request $request)

Renders an oEmbed resource.

Details

__construct(ResourceFetcherInterface $resource_fetcher, UrlResolverInterface $url_resolver, RendererInterface $renderer, LoggerInterface $logger, IFrameUrlHelper $iframe_url_helper)

Constructs an OEmbedIframeController instance.

Parameters

ResourceFetcherInterface $resource_fetcher

The oEmbed resource fetcher service.

UrlResolverInterface $url_resolver

The oEmbed URL resolver service.

RendererInterface $renderer

The renderer service.

LoggerInterface $logger

The logger channel.

IFrameUrlHelper $iframe_url_helper

The iFrame URL helper service.

static create(ContainerInterface $container)

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

ContainerInterface $container

The service container this instance should use.

Response render(Request $request)

Renders an oEmbed resource.

Parameters

Request $request

The request object.

Return Value

Response

The response object.

Exceptions

AccessDeniedHttpException