class OEmbedMediaSource

Same name and namespace in other branches
  1. 11.x core/modules/media/src/Attribute/OEmbedMediaSource.php \Drupal\media\Attribute\OEmbedMediaSource

Defines a OEmbedMediaSource attribute.

Plugin namespace: Plugin\media\Source

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

Hierarchy

  • class \Drupal\media\Attribute\OEmbedMediaSource implements \Drupal\media\Attribute\MediaSource

Expanded class hierarchy of OEmbedMediaSource

See also

\Drupal\media\MediaSourceInterface

\Drupal\media\MediaSourceBase

\Drupal\media\MediaSourceManager

hook_media_source_info_alter()

Plugin API

1 file declares its use of OEmbedMediaSource
OEmbed.php in core/modules/media/src/Plugin/media/Source/OEmbed.php

File

core/modules/media/src/Attribute/OEmbedMediaSource.php, line 22

Namespace

Drupal\media\Attribute
View source
class OEmbedMediaSource extends MediaSource {
  
  /**
   * Constructs a new OEmbedMediaSource attribute.
   *
   * @param string $id
   *   The attribute class ID.
   * @param \Drupal\Core\StringTranslation\TranslatableMarkup $label
   *   The human-readable name of the media source.
   * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $description
   *   (optional) A brief description of the media source.
   * @param string[] $allowed_field_types
   *   (optional) The field types that can be used as a source field for this
   *   media source.
   * @param class-string[] $forms
   *   (optional) 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, for example, 'media_library_add'.
   * @param string[] $providers
   *   (optional) A set of provider names, exactly as they appear in the
   *   canonical oEmbed provider database at https://oembed.com/providers.json.
   * @param string $default_thumbnail_filename
   *   (optional) 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.
   * @param string $thumbnail_uri_metadata_attribute
   *   (optional) The metadata attribute name to provide the thumbnail URI.
   * @param string $thumbnail_width_metadata_attribute
   *   (optional) The metadata attribute name to provide the thumbnail width.
   * @param string $thumbnail_height_metadata_attribute
   *   (optional) The metadata attribute name to provide the thumbnail height.
   * @param string|null $thumbnail_alt_metadata_attribute
   *   (optional) The metadata attribute name to provide the thumbnail alt.
   *   "Thumbnail" will be used if the attribute name is not provided.
   * @param string|null $thumbnail_title_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.
   * @param string $default_name_metadata_attribute
   *   (optional) The metadata attribute name to provide the default name.
   * @param class-string|null $deriver
   *   (optional) The deriver class.
   */
  public function __construct(public readonly string $id, public readonly TranslatableMarkup $label, public readonly ?TranslatableMarkup $description = NULL, public readonly array $allowed_field_types = [], public readonly array $forms = [], public readonly array $providers = [], public readonly string $default_thumbnail_filename = 'generic.png', public readonly string $thumbnail_uri_metadata_attribute = 'thumbnail_uri', public readonly string $thumbnail_width_metadata_attribute = 'thumbnail_width', public readonly string $thumbnail_height_metadata_attribute = 'thumbnail_height', public readonly ?string $thumbnail_alt_metadata_attribute = NULL, public readonly ?string $thumbnail_title_metadata_attribute = NULL, public readonly string $default_name_metadata_attribute = 'default_name', public readonly ?string $deriver = NULL) {
  }

}

Members

Title Sort descending Modifiers Object type Summary
OEmbedMediaSource::__construct public function Constructs a new OEmbedMediaSource attribute.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.