class MediaFilterController 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 a preview of the provided text.

Properties

protected RendererInterface $renderer

The renderer service.

protected ContentEntityStorageInterface $mediaStorage

The media storage.

protected EntityRepositoryInterface $entityRepository

The entity repository.

Methods

__construct(RendererInterface $renderer, ContentEntityStorageInterface $media_storage, EntityRepositoryInterface $entity_repository)

Constructs an MediaFilterController instance.

static 
create(ContainerInterface $container)

Instantiates a new instance of this class.

Response
preview(Request $request, FilterFormatInterface $filter_format)

Returns a HTML response containing a preview of the text after filtering.

formatUsesMediaEmbedFilter(FilterFormatInterface $filter_format)

Checks access based on media_embed filter status on the text format.

Details

__construct(RendererInterface $renderer, ContentEntityStorageInterface $media_storage, EntityRepositoryInterface $entity_repository)

Constructs an MediaFilterController instance.

Parameters

RendererInterface $renderer

The renderer service.

ContentEntityStorageInterface $media_storage

The media storage.

EntityRepositoryInterface $entity_repository

The entity repository.

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 preview(Request $request, FilterFormatInterface $filter_format)

Returns a HTML response containing a preview of the text after filtering.

Applies all of the given text format's filters, not just the media_embed filter, because for example filter_align and filter_caption may apply to it as well.

Parameters

Request $request

The request object.

FilterFormatInterface $filter_format

The text format.

Return Value

Response

The filtered text.

Exceptions

NotFoundHttpException

See also

EditorController::getUntransformedText

static AccessResultInterface formatUsesMediaEmbedFilter(FilterFormatInterface $filter_format)

Checks access based on media_embed filter status on the text format.

Parameters

FilterFormatInterface $filter_format

The text format for which to check access.

Return Value

AccessResultInterface

The access result.