You are here

public function BreakLockForm::getDescription in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views_ui/src/Form/BreakLockForm.php \Drupal\views_ui\Form\BreakLockForm::getDescription()

Returns additional text to display as a description.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup The form description.

Overrides EntityConfirmFormBase::getDescription

File

core/modules/views_ui/src/Form/BreakLockForm.php, line 72

Class

BreakLockForm
Builds the form to break the lock of an edited view.

Namespace

Drupal\views_ui\Form

Code

public function getDescription() {
  $locked = $this->tempStore
    ->getMetadata($this->entity
    ->id());
  $account = $this->entityTypeManager
    ->getStorage('user')
    ->load($locked
    ->getOwnerId());
  $username = [
    '#theme' => 'username',
    '#account' => $account,
  ];
  return $this
    ->t('By breaking this lock, any unsaved changes made by @user will be lost.', [
    '@user' => \Drupal::service('renderer')
      ->render($username),
  ]);
}