You are here

protected function SelectProfileForm::addUmamiWarning in Drupal 8

Show profile warning if 'demo_umami' profile is selected.

1 call to SelectProfileForm::addUmamiWarning()
SelectProfileForm::buildForm in core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php
Form constructor.

File

core/lib/Drupal/Core/Installer/Form/SelectProfileForm.php, line 151

Class

SelectProfileForm
Provides the profile selection form.

Namespace

Drupal\Core\Installer\Form

Code

protected function addUmamiWarning(array &$form) {

  // Warning to show when this profile is selected.
  $description = $form['profile']['demo_umami']['#description'];

  // Re-defines radio #description to show warning when selected.
  $form['profile']['demo_umami']['#description'] = [
    'warning' => [
      '#type' => 'item',
      '#markup' => $this
        ->t('This profile is intended for demonstration purposes only.'),
      '#wrapper_attributes' => [
        'class' => [
          'messages',
          'messages--warning',
        ],
      ],
      '#states' => [
        'visible' => [
          ':input[name="profile"]' => [
            'value' => 'demo_umami',
          ],
        ],
      ],
    ],
    'description' => [
      '#markup' => $description,
    ],
  ];
}