3 namespace Drupal\media\Annotation;
5 use Drupal\Component\Annotation\Plugin;
8 * Defines a media source plugin annotation object.
10 * Media sources are responsible for implementing all the logic for dealing
11 * with a particular type of media. They provide various universal and
12 * type-specific metadata about media of the type they handle.
14 * Plugin namespace: Plugin\media\Source
16 * For a working example, see \Drupal\media\Plugin\media\Source\File.
18 * @see \Drupal\media\MediaSourceInterface
19 * @see \Drupal\media\MediaSourceBase
20 * @see \Drupal\media\MediaSourceManager
21 * @see hook_media_source_info_alter()
26 class MediaSource extends Plugin {
36 * The human-readable name of the media source.
38 * @var \Drupal\Core\Annotation\Translation
40 * @ingroup plugin_translatable
45 * A brief description of the media source.
47 * @var \Drupal\Core\Annotation\Translation
49 * @ingroup plugin_translatable
51 public $description = '';
54 * The field types that can be used as a source field for this media source.
58 public $allowed_field_types = [];
61 * A filename for the default thumbnail.
63 * The thumbnails are placed in the directory defined by the config setting
64 * 'media.settings.icon_base_uri'. When using custom icons, make sure the
65 * module provides a hook_install() implementation to copy the custom icons
66 * to this directory. The media_install() function provides a clear example
71 * @see media_install()
73 public $default_thumbnail_filename = 'generic.png';
76 * The metadata attribute name to provide the thumbnail URI.
80 public $thumbnail_uri_metadata_attribute = 'thumbnail_uri';
83 * (optional) The metadata attribute name to provide the thumbnail alt.
85 * "Thumbnail" will be used if the attribute name is not provided.
89 public $thumbnail_alt_metadata_attribute;
92 * (optional) The metadata attribute name to provide the thumbnail title.
94 * The name of the media item will be used if the attribute name is not
99 public $thumbnail_title_metadata_attribute;
102 * The metadata attribute name to provide the default name.
106 public $default_name_metadata_attribute = 'default_name';