1 EntityReferenceSelectionHandlerGeneric.inc public EntityReferenceSelectionHandlerGeneric_file::getLabel($entity)

Implements EntityReferenceHandler::getLabel().

Overrides EntityReferenceSelectionHandlerGeneric::getLabel

File

core/modules/entityreference/plugins/selection/EntityReferenceSelectionHandlerGeneric.inc, line 506
Generic Entity handler.

Class

EntityReferenceSelectionHandlerGeneric_file
Override for the File entity type.

Code

public function getLabel($entity) {
  // The file entity doesn't have a label. Moreover, the filename is
  // sometimes empty, so use the basename in that case.
  return $entity->filename !== '' ? $entity->filename : basename($entity->uri);
}