function ModulesListConfirmForm::buildForm

Same name and namespace in other branches
  1. 9 core/modules/system/src/Form/ModulesListConfirmForm.php \Drupal\system\Form\ModulesListConfirmForm::buildForm()
  2. 10 core/modules/system/src/Form/ModulesListConfirmForm.php \Drupal\system\Form\ModulesListConfirmForm::buildForm()
  3. 11.x core/modules/system/src/Form/ModulesListConfirmForm.php \Drupal\system\Form\ModulesListConfirmForm::buildForm()

Overrides ConfirmFormBase::buildForm

File

core/modules/system/src/Form/ModulesListConfirmForm.php, line 115

Class

ModulesListConfirmForm
Builds a confirmation form for enabling modules with dependencies.

Namespace

Drupal\system\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
    $account = $this->currentUser()
        ->id();
    $this->modules = $this->keyValueExpirable
        ->get($account);
    // Redirect to the modules list page if the key value store is empty.
    if (!$this->modules) {
        return $this->redirect('system.modules_list');
    }
    $items = $this->buildMessageList();
    $form['message'] = [
        '#theme' => 'item_list',
        '#items' => $items,
    ];
    return parent::buildForm($form, $form_state);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.