function ModulesListNonStableConfirmForm::buildMessageList

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

Overrides ModulesListConfirmForm::buildMessageList

File

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

Class

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

Namespace

Drupal\system\Form

Code

protected function buildMessageList() {
    $this->buildNonStableInfo();
    $items = parent::buildMessageList();
    if (!empty($this->groupedModuleInfo[ExtensionLifecycle::EXPERIMENTAL])) {
        $this->messenger()
            ->addWarning($this->t('<a href=":url">Experimental modules</a> are provided for testing purposes only. Use at your own risk.', [
            ':url' => 'https://www.drupal.org/core/experimental',
        ]));
        // Add the list of experimental modules after any other messages.
        $items[] = $this->formatPlural(count($this->groupedModuleInfo[ExtensionLifecycle::EXPERIMENTAL]), 'The following module is experimental: @modules.', 'The following modules are experimental: @modules.', [
            '@modules' => implode(', ', $this->groupedModuleInfo[ExtensionLifecycle::EXPERIMENTAL]),
        ]);
    }
    if (!empty($this->groupedModuleInfo[ExtensionLifecycle::DEPRECATED])) {
        $this->messenger()
            ->addWarning($this->buildDeprecatedMessage($this->coreDeprecatedModules, $this->contribDeprecatedModules));
        $items = array_merge($items, $this->groupedModuleInfo[ExtensionLifecycle::DEPRECATED]);
    }
    return $items;
}

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