You are here

function system_modules_confirm_form in Drupal 6

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

Display confirmation form for dependencies.

Parameters

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

$storage: The contents of $form_state['storage']; an array with two elements: the list of dependencies 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 835
Admin page callbacks for the system module.

Code

function system_modules_confirm_form($modules, $storage) {
  $form = array();
  $items = array();
  list($dependencies, $status) = $storage;
  $form['validation_modules'] = array(
    '#type' => 'value',
    '#value' => $modules,
  );
  $form['status']['#tree'] = TRUE;

  // Remember list of modules selected on the module listing page already.
  foreach ($status as $key => $choice) {
    $form['status'][$key] = array(
      '#type' => 'value',
      '#value' => $choice,
    );
  }
  foreach ($dependencies as $name => $missing_dependencies) {
    $form['status'][$name] = array(
      '#type' => 'hidden',
      '#value' => 1,
    );
    foreach ($missing_dependencies as $k => $dependency) {
      $form['status'][$dependency] = array(
        '#type' => 'hidden',
        '#value' => 1,
      );
      $info = $modules[$dependency]->info;
      $missing_dependencies[$k] = $info['name'] ? $info['name'] : drupal_ucfirst($dependency);
    }
    $t_argument = array(
      '@module' => $modules[$name]->info['name'],
      '@dependencies' => implode(', ', $missing_dependencies),
    );
    $items[] = format_plural(count($missing_dependencies), 'You must enable the @dependencies module to install @module.', 'You must enable the @dependencies modules to install @module.', $t_argument);
  }
  $form['text'] = array(
    '#value' => theme('item_list', $items),
  );
  if ($form) {

    // Set some default form values
    $form = confirm_form($form, t('Some required modules must be enabled'), 'admin/build/modules', t('Would you like to continue with enabling the above?'), t('Continue'), t('Cancel'));
    return $form;
  }
}