class MediaSource extends Plugin (View source)

Defines a media source plugin annotation object.

Media sources are responsible for implementing all the logic for dealing with a particular type of media. They provide various universal and type-specific metadata about media of the type they handle.

Plugin namespace: Plugin\media\Source

For a working example, see \Drupal\media\Plugin\media\Source\File.

Properties

protected array $definition

The plugin definition read from the class annotation.

from  Plugin
string $id

The plugin ID.

Translation $label

The human-readable name of the media source.

Translation $description

A brief description of the media source.

string[] $allowed_field_types

The field types that can be used as a source field for this media source.

string[] $forms

The classes used to define media source-specific forms.

string $default_thumbnail_filename

A filename for the default thumbnail.

string $thumbnail_uri_metadata_attribute

The metadata attribute name to provide the thumbnail URI.

string|null $thumbnail_alt_metadata_attribute

(optional) The metadata attribute name to provide the thumbnail alt.

string|null $thumbnail_title_metadata_attribute

(optional) The metadata attribute name to provide the thumbnail title.

string $default_name_metadata_attribute

The metadata attribute name to provide the default name.

Methods

__construct($values)

Constructs a Plugin object.

from  Plugin
array
parse(array $values)

Parses an annotation into its definition.

from  Plugin
get()

Gets the value of an annotation.

from  Plugin
string
getProvider()

Gets the name of the provider of the annotated class.

from  Plugin
setProvider(string $provider)

Sets the name of the provider of the annotated class.

from  Plugin
string
getId()

Gets the unique ID for this annotated class.

from  Plugin
string
getClass()

Gets the class of the annotated class.

from  Plugin
setClass(string $class)

Sets the class of the annotated class.

from  Plugin

Details

__construct($values)

Constructs a Plugin object.

Builds up the plugin definition and invokes the get() method for any classed annotations that were used.

Parameters

$values

protected array parse(array $values)

Parses an annotation into its definition.

Parameters

array $values

The annotation array.

Return Value

array

The parsed annotation as a definition.

get()

Gets the value of an annotation.

string getProvider()

Gets the name of the provider of the annotated class.

Return Value

string

setProvider(string $provider)

Sets the name of the provider of the annotated class.

Parameters

string $provider

string getId()

Gets the unique ID for this annotated class.

Return Value

string

string getClass()

Gets the class of the annotated class.

Return Value

string

setClass(string $class)

Sets the class of the annotated class.

Parameters

string $class