You are here

public function Registration::label in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/Entity/Registration.php \Drupal\rng\Entity\Registration::label()
  2. 8 src/Entity/Registration.php \Drupal\rng\Entity\Registration::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 ContentEntityBase::label

File

src/Entity/Registration.php, line 102

Class

Registration
Defines the registration entity class.

Namespace

Drupal\rng\Entity

Code

public function label() {
  $owner = $this
    ->getOwner();
  $qty = $this
    ->getRegistrantQty();
  $registrations = '';
  if ($qty) {
    $registrations = '[' . $qty . ']';
  }
  if ($owner) {
    return t('@owner @regs', [
      '@owner' => $owner
        ->label(),
      '@regs' => $registrations,
    ]);
  }
  return t('New registration');
}