function ModulesListNonStableConfirmForm::buildNonStableInfo

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

Sets properties with information about non-stable modules being enabled.

1 call to ModulesListNonStableConfirmForm::buildNonStableInfo()
ModulesListNonStableConfirmForm::buildMessageList in core/modules/system/src/Form/ModulesListNonStableConfirmForm.php
Builds the message list for the confirmation form.

File

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

Class

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

Namespace

Drupal\system\Form

Code

protected function buildNonStableInfo() : void {
    $non_stable = $this->modules['non_stable'];
    $data = $this->moduleExtensionList
        ->getList();
    $grouped = [];
    $core_deprecated_modules = FALSE;
    $contrib_deprecated_modules = FALSE;
    foreach ($non_stable as $machine_name => $name) {
        $lifecycle = $data[$machine_name]->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER];
        if ($lifecycle === ExtensionLifecycle::EXPERIMENTAL) {
            // We just show the extension name if it is experimental.
            $grouped[$lifecycle][] = $name;
            continue;
        }
        $core_deprecated_modules = $core_deprecated_modules || $data[$machine_name]->origin === 'core';
        $contrib_deprecated_modules = $contrib_deprecated_modules || $data[$machine_name]->origin !== 'core';
        // If the extension is deprecated we show links to more information.
        $grouped[$lifecycle][] = Link::fromTextAndUrl($this->t('The @name module is deprecated. (more information)', [
            '@name' => $name,
        ]), Url::fromUri($data[$machine_name]->info[ExtensionLifecycle::LIFECYCLE_LINK_IDENTIFIER], [
            'attributes' => [
                'aria-label' => ' ' . $this->t('about the status of the @name module', [
                    '@name' => $name,
                ]),
            ],
        ]))
            ->toString();
    }
    $this->groupedModuleInfo = $grouped;
    $this->coreDeprecatedModules = $core_deprecated_modules;
    $this->contribDeprecatedModules = $contrib_deprecated_modules;
}

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