} } /**
* {@inheritdoc}
*/
public function submitForm(array &
$form, FormStateInterface
$form_state) { $local_cache = NULL;
$all_files =
$this->
getRequest()->files->
get('files',
[]);
if ($form_state->
getValue('project_url'
)) { $local_cache =
update_manager_file_get($form_state->
getValue('project_url'
));
if (!
$local_cache) { $this->
messenger()->
addError($this->
t('Unable to retrieve Drupal project from %url.',
['%url' =>
$form_state->
getValue('project_url'
)]));
return;
} } elseif (!
empty($all_files['project_upload'
]) &&
$this->moduleHandler->
moduleExists('file'
)) { $validators =
['file_validate_extensions' =>
[$this->archiverManager->
getExtensions()]];
if (!
($finfo =
file_save_upload('project_upload',
$validators, NULL, 0, FileSystemInterface::EXISTS_REPLACE
))) { // Failed to upload the file. file_save_upload() calls
// \Drupal\Core\Messenger\MessengerInterface::addError() on failure.
return;
}