You are here

public function Organization::label in CRM Core 8

Same name and namespace in other branches
  1. 8.3 modules/crm_core_contact/src/Entity/Organization.php \Drupal\crm_core_contact\Entity\Organization::label()
  2. 8.2 modules/crm_core_contact/src/Entity/Organization.php \Drupal\crm_core_contact\Entity\Organization::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/Organization.php, line 166

Class

Organization
CRM Organization Entity Class.

Namespace

Drupal\crm_core_contact\Entity

Code

public function label() {
  $label = $this
    ->get('name')->value;
  if (empty($label)) {
    $label = t('Nameless #@id', [
      '@id' => $this
        ->id(),
    ]);
  }
  \Drupal::moduleHandler()
    ->alter('crm_core_organization_label', $label, $this);
  return $label;
}