You are here

public function Bynder::getDefaultName in Bynder 8

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.

Parameters

\Drupal\media_entity\MediaInterface $media: The media object.

Return value

string The string that should be used as default media name.

Overrides MediaTypeBase::getDefaultName

File

src/Plugin/MediaEntity/Type/Bynder.php, line 322

Class

Bynder
Provides media type plugin for Bynder.

Namespace

Drupal\bynder\Plugin\MediaEntity\Type

Code

public function getDefaultName(MediaInterface $media) {
  if ($name = $this
    ->getField($media, 'name')) {
    return $name;
  }
  return parent::getDefaultName($media);
}