You are here

interface MediaTypeInterface in Media entity 8

Defines the interface for media types.

Hierarchy

Expanded class hierarchy of MediaTypeInterface

All classes that implement MediaTypeInterface

File

src/MediaTypeInterface.php, line 12

Namespace

Drupal\media_entity
View source
interface MediaTypeInterface extends PluginInspectionInterface, ConfigurablePluginInterface, PluginFormInterface {

  /**
   * Returns the display label.
   *
   * @return string
   *   The display label.
   */
  public function label();

  /**
   * Gets list of fields provided by this plugin.
   *
   * @return array
   *   Associative array with field names as keys and descriptions as values.
   */
  public function providedFields();

  /**
   * Gets a media-related field/value.
   *
   * @param MediaInterface $media
   *   Media object.
   * @param string $name
   *   Name of field to fetch.
   *
   * @return mixed
   *   Field value or FALSE if data unavailable.
   */
  public function getField(MediaInterface $media, $name);

  /**
   * Attaches type-specific constraints to media.
   *
   * @param MediaInterface $media
   *   Media entity.
   */
  public function attachConstraints(MediaInterface $media);

  /**
   * Gets thumbnail image.
   *
   * Media type plugin is responsible for returning URI of the generic thumbnail
   * if no other is available. This functions should always return a valid URI.
   *
   * @param MediaInterface $media
   *   Media.
   *
   * @return string
   *   URI of the thumbnail.
   */
  public function thumbnail(MediaInterface $media);

  /**
   * Gets the default thumbnail image.
   *
   * @return string
   *   Uri of the default thumbnail image.
   */
  public function getDefaultThumbnail();

  /**
   * Provide a default name for the media.
   *
   * Plugins defining media bundles are suggested to override this method and
   * provide a default name, to be used when there is no user-defined label
   * available.
   *
   * @param \Drupal\media_entity\MediaInterface $media
   *   The media object.
   *
   * @return string
   *   The string that should be used as default media name.
   */
  public function getDefaultName(MediaInterface $media);

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurablePluginInterface::defaultConfiguration public function Gets default configuration for this plugin. 1
ConfigurablePluginInterface::getConfiguration public function Gets this plugin's configuration. 1
ConfigurablePluginInterface::setConfiguration public function Sets the configuration for this plugin instance. 1
DependentPluginInterface::calculateDependencies public function Calculates dependencies for the configured plugin. 19
MediaTypeInterface::attachConstraints public function Attaches type-specific constraints to media. 1
MediaTypeInterface::getDefaultName public function Provide a default name for the media. 1
MediaTypeInterface::getDefaultThumbnail public function Gets the default thumbnail image. 1
MediaTypeInterface::getField public function Gets a media-related field/value. 1
MediaTypeInterface::label public function Returns the display label. 1
MediaTypeInterface::providedFields public function Gets list of fields provided by this plugin. 1
MediaTypeInterface::thumbnail public function Gets thumbnail image. 1
PluginFormInterface::buildConfigurationForm public function Form constructor. 36
PluginFormInterface::submitConfigurationForm public function Form submission handler. 32
PluginFormInterface::validateConfigurationForm public function Form validation handler. 18
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2