ModulesListExperimentalConfirmForm.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Drupal\system\Form;
  3. /**
  4. * Builds a confirmation form for enabling experimental modules.
  5. *
  6. * @internal
  7. */
  8. class ModulesListExperimentalConfirmForm extends ModulesListConfirmForm {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function getQuestion() {
  13. return $this->t('Are you sure you wish to enable experimental modules?');
  14. }
  15. /**
  16. * {@inheritdoc}
  17. */
  18. public function getFormId() {
  19. return 'system_modules_experimental_confirm_form';
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. protected function buildMessageList() {
  25. $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']));
  26. $items = parent::buildMessageList();
  27. // Add the list of experimental modules after any other messages.
  28. $items[] = $this->t('The following modules are experimental: @modules', ['@modules' => implode(', ', array_values($this->modules['experimental']))]);
  29. return $items;
  30. }
  31. }