function TempStoreTrait::lockInformationMessage

Provides a lock info message.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup The message suitable to be shown in the UI.

2 calls to TempStoreTrait::lockInformationMessage()
TempStoreTrait::addLockInformation in src/Ui/TempStoreTrait.php
TempStoreTrait::validateLock in src/Ui/TempStoreTrait.php

File

src/Ui/TempStoreTrait.php, line 279

Class

TempStoreTrait
Provides methods for modified rules components in temporary storage.

Namespace

Drupal\rules\Ui

Code

private function lockInformationMessage() {
    $lock = $this->getLockMetaData();
    $username = [
        '#theme' => 'username',
        '#account' => $this->getEntityTypeManager()
            ->getStorage('user')
            ->load($lock->getOwnerId()),
    ];
    $lock_message_substitutions = [
        '@user' => $this->getRenderer()
            ->render($username),
        '@age' => $this->getDateFormatter()
            ->formatTimeDiffSince($lock->getUpdated()),
        '@component_type' => $this->getRulesUiHandler()
            ->getPluginDefinition()->component_type_label,
        ':url' => Url::fromRoute($this->getRulesUiHandler()
            ->getPluginDefinition()->base_route . '.break_lock', \Drupal::routeMatch()->getRawParameters()
            ->all())
            ->toString(),
    ];
    return $this->t('This @component_type is being edited by user @user, and is therefore locked from editing by others. This lock is @age old. Click here to <a href=":url">break this lock</a>.', $lock_message_substitutions);
}