You are here

protected function ModulesListConfirmForm::buildMessageList in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/src/Form/ModulesListConfirmForm.php \Drupal\system\Form\ModulesListConfirmForm::buildMessageList()
  2. 9 core/modules/system/src/Form/ModulesListConfirmForm.php \Drupal\system\Form\ModulesListConfirmForm::buildMessageList()

Builds the message list for the confirmation form.

Return value

\Drupal\Component\Render\MarkupInterface[] Array of markup for the list of messages on the form.

See also

\Drupal\system\Form\ModulesListForm::buildModuleList()

1 call to ModulesListConfirmForm::buildMessageList()
ModulesListConfirmForm::buildForm in core/modules/system/src/Form/ModulesListConfirmForm.php
Form constructor.

File

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

Class

ModulesListConfirmForm
Builds a confirmation form for enabling modules with dependencies.

Namespace

Drupal\system\Form

Code

protected function buildMessageList() {
  $items = [];
  if (!empty($this->modules['dependencies'])) {

    // Display a list of required modules that have to be installed as well
    // but were not manually selected.
    foreach ($this->modules['dependencies'] as $module => $dependencies) {
      $items[] = $this
        ->formatPlural(count($dependencies), 'You must enable the @required module to install @module.', 'You must enable the @required modules to install @module.', [
        '@module' => $this->modules['install'][$module],
        // It is safe to implode this because module names are not translated
        // markup and so will not be double-escaped.
        '@required' => implode(', ', $dependencies),
      ]);
    }
  }
  return $items;
}