You are here

public function EntityReference_SelectionHandler_Generic_file::getLabel in Entity reference 7

Implements EntityReferenceHandler::getLabel().

Overrides EntityReference_SelectionHandler_Generic::getLabel

File

plugins/selection/EntityReference_SelectionHandler_Generic.class.php, line 498

Class

EntityReference_SelectionHandler_Generic_file
Override for the File type.

Code

public function getLabel($entity) {

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