annotate core/modules/media/src/Annotation/MediaSource.php @ 19:fa3358dc1485 tip

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