function Media::getName

Same name in other branches
  1. 9 core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::getName()
  2. 8.9.x core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::getName()
  3. 11.x core/modules/media/src/Entity/Media.php \Drupal\media\Entity\Media::getName()

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 100

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;
}

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