public function Profile::defaultLabel in Profile 2 7
Same name and namespace in other branches
- 7.2 profile2.module \Profile::defaultLabel()
Defines the entity label if the 'entity_class_label' callback is used.
Specify 'entity_class_label' as 'label callback' in hook_entity_info() to let the entity label point to this method. Override this in order to implement a custom default label.
Overrides Entity::defaultLabel
File
- ./
profile2.module, line 977 - Support for configurable user profiles.
Class
- Profile
- The class used for profile entities.
Code
public function defaultLabel() {
$type = profile2_get_types($this->type);
if (!empty($type->data['edit_label'])) {
return $this->label;
}
else {
// Return a label that combines the type name and user name, translatable.
return t('@type profile for @user', array(
'@type' => $type
->getTranslation('label'),
'@user' => format_username($this
->user()),
));
}
}