class MediaSource in Drupal 10
Same name and namespace in other branches
- 8 core/modules/media/src/Annotation/MediaSource.php \Drupal\media\Annotation\MediaSource
- 9 core/modules/media/src/Annotation/MediaSource.php \Drupal\media\Annotation\MediaSource
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.
Hierarchy
- class \Drupal\Component\Annotation\Plugin implements AnnotationInterface
- class \Drupal\media\Annotation\MediaSource
Expanded class hierarchy of MediaSource
See also
\Drupal\media\MediaSourceInterface
\Drupal\media\MediaSourceManager
hook_media_source_info_alter()
Related topics
1 file declares its use of MediaSource
- MediaSourceManager.php in core/
modules/ media/ src/ MediaSourceManager.php
10 classes are annotated with MediaSource
- AudioFile in core/
modules/ media/ src/ Plugin/ media/ Source/ AudioFile.php - Media source wrapping around an audio file.
- File in core/
modules/ media/ src/ Plugin/ media/ Source/ File.php - File entity media source.
- Image in core/
modules/ media/ src/ Plugin/ media/ Source/ Image.php - Image entity media source.
- OEmbed in core/
modules/ media/ src/ Plugin/ media/ Source/ OEmbed.php - Provides a media source plugin for oEmbed resources.
- Test in core/
modules/ media/ tests/ modules/ media_test_source/ src/ Plugin/ media/ Source/ Test.php - Provides test media source.
File
- core/
modules/ media/ src/ Annotation/ MediaSource.php, line 26
Namespace
Drupal\media\AnnotationView source
class MediaSource extends Plugin {
/**
* The plugin ID.
*
* @var string
*/
public $id;
/**
* The human-readable name of the media source.
*
* @var \Drupal\Core\Annotation\Translation
*
* @ingroup plugin_translatable
*/
public $label;
/**
* A brief description of the media source.
*
* @var \Drupal\Core\Annotation\Translation
*
* @ingroup plugin_translatable
*/
public $description = '';
/**
* The field types that can be used as a source field for this media source.
*
* @var string[]
*/
public $allowed_field_types = [];
/**
* The classes used to define media source-specific forms.
*
* An array of form class names, keyed by ID. The ID represents the operation
* the form is used for.
*
* @var string[]
*/
public $forms = [];
/**
* A filename for the default thumbnail.
*
* The thumbnails are placed in the directory defined by the config setting
* 'media.settings.icon_base_uri'. When using custom icons, make sure the
* module provides a hook_install() implementation to copy the custom icons
* to this directory. The media_install() function provides a clear example
* of how to do this.
*
* @var string
*
* @see media_install()
*/
public $default_thumbnail_filename = 'generic.png';
/**
* The metadata attribute name to provide the thumbnail URI.
*
* @var string
*/
public $thumbnail_uri_metadata_attribute = 'thumbnail_uri';
/**
* (optional) The metadata attribute name to provide the thumbnail alt.
*
* "Thumbnail" will be used if the attribute name is not provided.
*
* @var string|null
*/
public $thumbnail_alt_metadata_attribute;
/**
* (optional) The metadata attribute name to provide the thumbnail title.
*
* The name of the media item will be used if the attribute name is not
* provided.
*
* @var string|null
*/
public $thumbnail_title_metadata_attribute;
/**
* The metadata attribute name to provide the default name.
*
* @var string
*/
public $default_name_metadata_attribute = 'default_name';
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MediaSource:: |
public | property | The field types that can be used as a source field for this media source. | |
MediaSource:: |
public | property | The metadata attribute name to provide the default name. | |
MediaSource:: |
public | property | A filename for the default thumbnail. | |
MediaSource:: |
public | property | A brief description of the media source. | |
MediaSource:: |
public | property | The classes used to define media source-specific forms. | |
MediaSource:: |
public | property | The plugin ID. | |
MediaSource:: |
public | property | The human-readable name of the media source. | |
MediaSource:: |
public | property | (optional) The metadata attribute name to provide the thumbnail alt. | |
MediaSource:: |
public | property | (optional) The metadata attribute name to provide the thumbnail title. | |
MediaSource:: |
public | property | The metadata attribute name to provide the thumbnail URI. | |
Plugin:: |
protected | property | The plugin definition read from the class annotation. | 1 |
Plugin:: |
public | function |
Gets the value of an annotation. Overrides AnnotationInterface:: |
6 |
Plugin:: |
public | function |
Gets the class of the annotated class. Overrides AnnotationInterface:: |
1 |
Plugin:: |
public | function |
Gets the unique ID for this annotated class. Overrides AnnotationInterface:: |
|
Plugin:: |
public | function |
Gets the name of the provider of the annotated class. Overrides AnnotationInterface:: |
1 |
Plugin:: |
protected | function | Parses an annotation into its definition. | |
Plugin:: |
public | function |
Sets the class of the annotated class. Overrides AnnotationInterface:: |
1 |
Plugin:: |
public | function |
Sets the name of the provider of the annotated class. Overrides AnnotationInterface:: |
|
Plugin:: |
public | function | Constructs a Plugin object. | 3 |