1 system.admin.inc system_modules_confirm_form($modules, $storage)

Display confirmation form for required modules.

Parameters

$modules: Array of module file objects as returned from system_rebuild_module_data().

$storage: The contents of $form_state['storage']; an array with two elements: the list of required modules and the list of status form field values from the previous screen.

Related topics

File

core/modules/system/system.admin.inc, line 887
Admin page callbacks for the System module.

Code

function system_modules_confirm_form($modules, $storage) {
  $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['text'] = array('#markup' => theme('item_list', array('items' => $items)));

  if ($form) {
    // Set some default form values
    $form = confirm_form(
    $form, 
    t('Some required modules must be enabled'), 
    'admin/modules', 
    t('Would you like to continue with the above?'), 
    t('Continue'), 
    t('Cancel'));
    // Removing the button-danger class so that button-primary will be added automatically for us.
    unset($form['actions']['submit']['#attributes']['class']);
    return $form;
  }
}