class ModulesInstallConfirmForm

Builds a confirmation form for required modules.

Used internally in system_modules().

Hierarchy

Expanded class hierarchy of ModulesInstallConfirmForm

1 file declares its use of ModulesInstallConfirmForm
system.admin.inc in drupal/core/modules/system/system.admin.inc
Admin page callbacks for the system module.

File

drupal/core/modules/system/lib/Drupal/system/Form/ModulesInstallConfirmForm.php, line 17
Contains \Drupal\system\Form\ModulesInstallConfirmForm.

Namespace

Drupal\system\Form
View source
class ModulesInstallConfirmForm extends ConfirmFormBase {

  /**
   * {@inheritdoc}
   */
  protected function getQuestion() {
    return t('Some required modules must be enabled');
  }

  /**
   * {@inheritdoc}
   */
  protected function getConfirmText() {
    return t('Continue');
  }

  /**
   * {@inheritdoc}
   */
  protected function getCancelPath() {
    return 'admin/modules';
  }

  /**
   * {@inheritdoc}
   */
  protected function getDescription() {
    return t('Would you like to continue with the above?');
  }

  /**
   * {@inheritdoc}
   */
  public function getFormID() {
    return 'system_modules_confirm_form';
  }

  /**
   * {@inheritdoc}
   * @param array $modules
   *   The array of modules.
   * @param array $storage
   *   Temporary storage of module dependency information.
   */
  public function buildForm(array $form, array &$form_state, $modules = array(), $storage = array()) {
    $items = array();
    $form['validation_modules'] = array(
      '#type' => 'value',
      '#value' => $modules,
    );
    $form['status']['#tree'] = TRUE;
    foreach ($storage['more_required'] as $info) {
      $t_argument = array(
        '@module' => $info['name'],
        '@required' => implode(', ', $info['requires']),
      );
      $items[] = format_plural(count($info['requires']), 'You must enable the @required module to install @module.', 'You must enable the @required modules to install @module.', $t_argument);
    }
    foreach ($storage['missing_modules'] as $name => $info) {
      $t_argument = array(
        '@module' => $name,
        '@depends' => implode(', ', $info['depends']),
      );
      $items[] = format_plural(count($info['depends']), 'The @module module is missing, so the following module will be disabled: @depends.', 'The @module module is missing, so the following modules will be disabled: @depends.', $t_argument);
    }
    $form['modules'] = array(
      '#theme' => 'item_list',
      '#items' => $items,
    );
    return parent::buildForm($form, $form_state);
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, array &$form_state) {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfirmFormBase::getCancelText protected function Returns a caption for the link which cancels the action. 2
ConfirmFormBase::getFormName protected function Returns the internal name used to refer to the confirmation item.
ConfirmFormBase::validateForm public function Implements \Drupal\Core\Form\FormInterface::validateForm(). Overrides FormInterface::validateForm 1
ModulesInstallConfirmForm::buildForm public function Overrides ConfirmFormBase::buildForm
ModulesInstallConfirmForm::getCancelPath protected function Returns the page to go to if the user cancels the action. Overrides ConfirmFormBase::getCancelPath
ModulesInstallConfirmForm::getConfirmText protected function Returns a caption for the button that confirms the action. Overrides ConfirmFormBase::getConfirmText
ModulesInstallConfirmForm::getDescription protected function Returns additional text to display as a description. Overrides ConfirmFormBase::getDescription
ModulesInstallConfirmForm::getFormID public function Returns a unique string identifying the form. Overrides FormInterface::getFormID
ModulesInstallConfirmForm::getQuestion protected function Returns the question to ask the user. Overrides ConfirmFormBase::getQuestion
ModulesInstallConfirmForm::submitForm public function Form submission handler. Overrides FormInterface::submitForm