function ModulesListNonStableConfirmForm::getQuestion

Same name in other branches
  1. 10 core/modules/system/src/Form/ModulesListNonStableConfirmForm.php \Drupal\system\Form\ModulesListNonStableConfirmForm::getQuestion()
  2. 11.x core/modules/system/src/Form/ModulesListNonStableConfirmForm.php \Drupal\system\Form\ModulesListNonStableConfirmForm::getQuestion()

Overrides ModulesListConfirmForm::getQuestion

File

core/modules/system/src/Form/ModulesListNonStableConfirmForm.php, line 82

Class

ModulesListNonStableConfirmForm
Builds a confirmation form for enabling experimental and deprecated modules.

Namespace

Drupal\system\Form

Code

public function getQuestion() {
    $hasExperimentalModulesToEnable = !empty($this->groupedModuleInfo[ExtensionLifecycle::EXPERIMENTAL]);
    $hasDeprecatedModulesToEnable = !empty($this->groupedModuleInfo[ExtensionLifecycle::DEPRECATED]);
    if ($hasExperimentalModulesToEnable && $hasDeprecatedModulesToEnable) {
        return $this->t('Are you sure you wish to enable experimental and deprecated modules?');
    }
    if ($hasExperimentalModulesToEnable) {
        return $this->formatPlural(count($this->groupedModuleInfo[ExtensionLifecycle::EXPERIMENTAL]), 'Are you sure you wish to enable an experimental module?', 'Are you sure you wish to enable experimental modules?');
    }
    if ($hasDeprecatedModulesToEnable) {
        return $this->formatPlural(count($this->groupedModuleInfo[ExtensionLifecycle::DEPRECATED]), 'Are you sure you wish to enable a deprecated module?', 'Are you sure you wish to enable deprecated modules?');
    }
}

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