function UpdateManagerInstall::buildForm
Same name in other branches
- 9 core/modules/update/src/Form/UpdateManagerInstall.php \Drupal\update\Form\UpdateManagerInstall::buildForm()
- 8.9.x core/modules/update/src/Form/UpdateManagerInstall.php \Drupal\update\Form\UpdateManagerInstall::buildForm()
- 10 core/modules/update/src/Form/UpdateManagerInstall.php \Drupal\update\Form\UpdateManagerInstall::buildForm()
Overrides FormInterface::buildForm
File
-
core/
modules/ update/ src/ Form/ UpdateManagerInstall.php, line 91
Class
- UpdateManagerInstall
- Configure update settings for this site.
Namespace
Drupal\update\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$this->moduleHandler
->loadInclude('update', 'inc', 'update.manager');
if (!_update_manager_check_backends($form, 'install')) {
return $form;
}
$form['help_text'] = [
'#prefix' => '<p>',
'#markup' => $this->t('You can find <a href=":module_url">modules</a> and <a href=":theme_url">themes</a> on <a href=":drupal_org_url">drupal.org</a>. The following file extensions are supported: %extensions.', [
':module_url' => 'https://www.drupal.org/project/modules',
':theme_url' => 'https://www.drupal.org/project/themes',
':drupal_org_url' => 'https://www.drupal.org',
'%extensions' => $this->archiverManager
->getExtensions(),
]),
'#suffix' => '</p>',
];
$form['project_url'] = [
'#type' => 'url',
'#title' => $this->t('Add from a URL'),
'#description' => $this->t('For example: %url', [
'%url' => 'https://ftp.drupal.org/files/projects/name.tar.gz',
]),
];
// Provide upload option only if file module exists.
if ($this->moduleHandler
->moduleExists('file')) {
$form['information'] = [
'#prefix' => '<strong>',
'#markup' => $this->t('Or'),
'#suffix' => '</strong>',
];
$form['project_upload'] = [
'#type' => 'file',
'#title' => $this->t('Upload a module or theme archive'),
'#description' => $this->t('For example: %filename from your local computer', [
'%filename' => 'name.tar.gz',
]),
];
}
$form['actions'] = [
'#type' => 'actions',
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#button_type' => 'primary',
'#value' => $this->t('Continue'),
];
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.