update_manager_install_form

Versions
mediamosa-21
update_manager_install_form($form, &$form_state, $context)

Build the form for the update manager page to install new projects.

This presents a place to enter a URL or upload an archive file to use to install a new module or theme.

_state

Parameters

$form

$context String representing the context from which we're trying to install, can be: 'module', 'theme' or 'report'.

Return value

The form array for selecting which project to install.

Related topics

Code

modules/update/update.manager.inc, line 460

<?php
function update_manager_install_form($form, &$form_state, $context) {
  $form = array();

  // Collect all the supported archive file extensions for the UI text.
  $extensions = array();
  $archiver_info = archiver_get_info();
  foreach ($archiver_info as $info) {
    if (!empty($info['extensions'])) {
      $extensions += $info['extensions'];
    }
  }
  $form['help_text'] = array(
    '#prefix' => '<p>',
    '#markup' => t('To install a new module or theme, either enter the URL of an archive file you wish to install, or upload the archive file that you have downloaded. You can find <a href="@module_url">modules</a> and <a href="@theme_url">themes</a> at <a href="@drupal_org_url">http://drupal.org</a>. The following archive extensions are supported: %extensions', array('@module_url' => 'http://drupal.org/project/modules', '@theme_url' => 'http://drupal.org/project/themes', '@drupal_org_url' => 'http://drupal.org', '%extensions' => implode(', ', $extensions))),
    '#suffix' => '</p>',
  );

  $form['project_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Install from a URL'),
    '#description' => t('For example: %url', array('%url' => 'http://ftp.drupal.org/files/projects/name.tar.gz')),
  );

  $form['information'] = array(
    '#prefix' => '<strong>',
    '#markup' => t('Or'),
    '#suffix' => '</strong>',
  );

  $form['project_upload'] = array(
    '#type' => 'file',
    '#title' => t('Upload a module or theme archive to install'),
    '#description' => t('For example: %filename from your local computer', array('%filename' => 'name.tar.gz')),
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Install'),
  );

  return $form;
}
?>