You are here

public function ScheduledUpdate::label in Scheduled Updates 8

Return the entity label, which is the update time.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup|mixed|string|null

Overrides ContentEntityBase::label

File

src/Entity/ScheduledUpdate.php, line 265
Contains \Drupal\scheduled_updates\Entity\ScheduledUpdate.

Class

ScheduledUpdate
Defines the Scheduled update entity.

Namespace

Drupal\scheduled_updates\Entity

Code

public function label() {
  if (!$this
    ->get('update_timestamp')
    ->isEmpty()) {

    /** @var \Drupal\Core\Datetime\DateFormatterInterface $formatter */
    $formatter = \Drupal::service('date.formatter');
    return $formatter
      ->format($this
      ->get('update_timestamp')
      ->getString());
  }
  return $this
    ->t('No update time specified');
}