You are here

function system_modules_confirm_form in Drupal 7

Same name and namespace in other branches
  1. 5 modules/system/system.module \system_modules_confirm_form()
  2. 6 modules/system/system.admin.inc \system_modules_confirm_form()

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

1 call to system_modules_confirm_form()
system_modules in modules/system/system.admin.inc
Menu callback; provides module enable/disable interface.

File

modules/system/system.admin.inc, line 1069
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'));
    return $form;
  }
}