You are here

public function UpdateReady::buildForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/update/src/Form/UpdateReady.php \Drupal\update\Form\UpdateReady::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

core/modules/update/src/Form/UpdateReady.php, line 90

Class

UpdateReady
Configure update settings for this site.

Namespace

Drupal\update\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $this->moduleHandler
    ->loadInclude('update', 'inc', 'update.manager');
  if (!_update_manager_check_backends($form, 'update')) {
    return $form;
  }
  $form['backup'] = [
    '#prefix' => '<strong>',
    '#markup' => $this
      ->t('Back up your database and site before you continue. <a href=":backup_url">Learn how</a>.', [
      ':backup_url' => 'https://www.drupal.org/node/22281',
    ]),
    '#suffix' => '</strong>',
  ];
  $form['maintenance_mode'] = [
    '#title' => $this
      ->t('Perform updates with site in maintenance mode (strongly recommended)'),
    '#type' => 'checkbox',
    '#default_value' => TRUE,
  ];
  $form['actions'] = [
    '#type' => 'actions',
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Continue'),
  ];
  return $form;
}