function TempStoreTrait::addLockInformation

See also

\Drupal\rules\Ui\RulesUiHandlerInterface::addLockInformation()

File

src/Ui/TempStoreTrait.php, line 236

Class

TempStoreTrait
Provides methods for modified rules components in temporary storage.

Namespace

Drupal\rules\Ui

Code

public function addLockInformation() {
    $build = [];
    if ($this->isLocked()) {
        $build['locked'] = [
            '#type' => 'container',
            '#attributes' => [
                'class' => [
                    'rules-locked',
                    'messages',
                    'messages--warning',
                ],
            ],
            '#children' => $this->lockInformationMessage(),
            '#weight' => -10,
        ];
    }
    else {
        $build['changed'] = [
            '#type' => 'container',
            '#attributes' => [
                'class' => [
                    'rules-changed',
                    'messages',
                    'messages--warning',
                ],
            ],
            '#children' => $this->t('You have unsaved changes.'),
            '#weight' => -10,
        ];
        if (!$this->isEdited()) {
            $build['changed']['#attributes']['class'][] = 'js-hide';
        }
    }
    return $build;
}