You are here

public function Media::getName in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::getName()

Gets the media item name.

Return value

string The name of the media item.

Overrides MediaInterface::getName

1 call to Media::getName()
Media::label in core/modules/media/src/Entity/Media.php
Gets the label of the entity.

File

core/modules/media/src/Entity/Media.php, line 94

Class

Media
Defines the media entity class.

Namespace

Drupal\media\Entity

Code

public function getName() {
  $name = $this
    ->getEntityKey('label');
  if (empty($name)) {
    $media_source = $this
      ->getSource();
    return $media_source
      ->getMetadata($this, $media_source
      ->getPluginDefinition()['default_name_metadata_attribute']);
  }
  return $name;
}