protected function CommerceFileLicenseEntity::defaultLabel in Commerce File 7
Specifies the default label, which is picked up by label() by default.
Overrides Entity::defaultLabel
File
- includes/
commerce_file_license.entity.inc, line 106 - Provides a base class for CommerceFileLicenseEntity.
Class
- CommerceFileLicenseEntity
- A Commerce File License entity class.
Code
protected function defaultLabel() {
$parts = array();
$file = $this
->get_file();
$owner = $this
->get_owner();
if (!empty($file['filename'])) {
$parts[] = $file['filename'];
}
if (!empty($owner->name)) {
$parts[] = ' ' . t('owned by ') . $owner->name;
}
if (!empty($parts)) {
return implode(' ', $parts);
}
return $this->entityInfo['label'] . ' ' . $this
->internalIdentifier();
}