public function Individual::label in CRM Core 8
Same name and namespace in other branches
- 8.3 modules/crm_core_contact/src/Entity/Individual.php \Drupal\crm_core_contact\Entity\Individual::label()
- 8.2 modules/crm_core_contact/src/Entity/Individual.php \Drupal\crm_core_contact\Entity\Individual::label()
Gets the label of the entity.
Return value
string|null The label of the entity, or NULL if there is no label defined.
Overrides EntityInterface::label
File
- modules/
crm_core_contact/ src/ Entity/ Individual.php, line 167
Class
- Individual
- CRM Individual Entity Class.
Namespace
Drupal\crm_core_contact\EntityCode
public function label() {
$label = '';
if ($item = $this
->get('name')
->first()) {
$label = "{$item->given} {$item->family}";
}
if (empty(trim($label))) {
$label = t('Nameless #@id', [
'@id' => $this
->id(),
]);
}
\Drupal::moduleHandler()
->alter('crm_core_individual_label', $label, $this);
return $label;
}