1<?php 2 3namespace Drupal\media\Annotation; 4 5use Drupal\Component\Annotation\Plugin; 6 7/** 8 * Defines a media source plugin annotation object. 9 * 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. 13 * 14 * Plugin namespace: Plugin\media\Source 15 * 16 * For a working example, see \Drupal\media\Plugin\media\Source\File. 17 * 18 * @see \Drupal\media\MediaSourceInterface 19 * @see \Drupal\media\MediaSourceBase 20 * @see \Drupal\media\MediaSourceManager 21 * @see hook_media_source_info_alter() 22 * @see plugin_api 23 * 24 * @Annotation 25 */ 26class MediaSource extends Plugin { 27 28 /** 29 * The plugin ID. 30 * 31 * @var string 32 */ 33 public $id; 34 35 /** 36 * The human-readable name of the media source. 37 * 38 * @var \Drupal\Core\Annotation\Translation 39 * 40 * @ingroup plugin_translatable 41 */ 42 public $label; 43 44 /** 45 * A brief description of the media source. 46 * 47 * @var \Drupal\Core\Annotation\Translation 48 * 49 * @ingroup plugin_translatable 50 */ 51 public $description = ''; 52 53 /** 54 * The field types that can be used as a source field for this media source. 55 * 56 * @var string[] 57 */ 58 public $allowed_field_types = []; 59 60 /** 61 * The classes used to define media source-specific forms. 62 * 63 * An array of form class names, keyed by ID. The ID represents the operation 64 * the form is used for. 65 * 66 * @var string[] 67 */ 68 public $forms = []; 69 70 /** 71 * A filename for the default thumbnail. 72 * 73 * The thumbnails are placed in the directory defined by the config setting 74 * 'media.settings.icon_base_uri'. When using custom icons, make sure the 75 * module provides a hook_install() implementation to copy the custom icons 76 * to this directory. The media_install() function provides a clear example 77 * of how to do this. 78 * 79 * @var string 80 * 81 * @see media_install() 82 */ 83 public $default_thumbnail_filename = 'generic.png'; 84 85 /** 86 * The metadata attribute name to provide the thumbnail URI. 87 * 88 * @var string 89 */ 90 public $thumbnail_uri_metadata_attribute = 'thumbnail_uri'; 91 92 /** 93 * (optional) The metadata attribute name to provide the thumbnail alt. 94 * 95 * "Thumbnail" will be used if the attribute name is not provided. 96 * 97 * @var string|null 98 */ 99 public $thumbnail_alt_metadata_attribute; 100 101 /** 102 * (optional) The metadata attribute name to provide the thumbnail title. 103 * 104 * The name of the media item will be used if the attribute name is not 105 * provided. 106 * 107 * @var string|null 108 */ 109 public $thumbnail_title_metadata_attribute; 110 111 /** 112 * The metadata attribute name to provide the default name. 113 * 114 * @var string 115 */ 116 public $default_name_metadata_attribute = 'default_name'; 117 118} 119