public function Message::defaultLabel

File

src/Entity/Message.php, line 72

Class

Message
Entity class for the tmgmt_message entity.

Namespace

Drupal\tmgmt\Entity

Code

public function defaultLabel() {
  $created = \Drupal::service('date.formatter')
    ->format($this
    ->get('created')->value);
  switch ($this->type->value) {
    case 'error':
      return t('Error message from @time', array(
        '@time' => $created,
      ));
    case 'status':
      return t('Status message from @time', array(
        '@time' => $created,
      ));
    case 'warning':
      return t('Warning message from @time', array(
        '@time' => $created,
      ));
    case 'debug':
      return t('Debug message from @time', array(
        '@time' => $created,
      ));
  }
}