diff --git a/core/authorize.php b/core/authorize.php
index 95dae01..638558e 100644
--- a/core/authorize.php
+++ b/core/authorize.php
@@ -20,7 +20,6 @@
* @link authorize Authorized operation helper functions @endlink
*/
-use Drupal\Core\FileTransfer\Form\FileTransferAuthorizeForm;
use Symfony\Component\HttpFoundation\Request;
// Change the directory to the Drupal root.
@@ -149,7 +148,7 @@ function authorize_access_allowed() {
}
elseif (!$batch = batch_get()) {
// We have a batch to process, show the filetransfer form.
- $elements = drupal_get_form(new FileTransferAuthorizeForm());
+ $elements = \Drupal::formBuilder()->getForm('Drupal\Core\FileTransfer\Form\FileTransferAuthorizeForm');
$output = drupal_render($elements);
}
}
diff --git a/core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php b/core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php
index f157c77..e4a5390 100644
--- a/core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php
+++ b/core/lib/Drupal/Core/FileTransfer/Form/FileTransferAuthorizeForm.php
@@ -30,7 +30,7 @@ public function buildForm(array $form, array &$form_state) {
// Get all the available ways to transfer files.
if (empty($_SESSION['authorize_filetransfer_info'])) {
- drupal_set_message(t('Unable to continue, no available methods of file transfer'), 'error');
+ drupal_set_message($this->t('Unable to continue, no available methods of file transfer'), 'error');
return array();
}
$available_backends = $_SESSION['authorize_filetransfer_info'];
@@ -38,7 +38,7 @@ public function buildForm(array $form, array &$form_state) {
if (!$this->getRequest()->isSecure()) {
$form['information']['https_warning'] = array(
'#prefix' => '
',
- '#markup' => t('WARNING: You are not using an encrypted connection, so your password will be sent in plain text.
Learn more.', array('@https-link' => 'http://drupal.org/https-information')),
+ '#markup' => $this->t('WARNING: You are not using an encrypted connection, so your password will be sent in plain text.
Learn more.', array('@https-link' => 'http://drupal.org/https-information')),
'#suffix' => '
',
);
}
@@ -54,14 +54,14 @@ public function buildForm(array $form, array &$form_state) {
$form['information']['main_header'] = array(
'#prefix' => '',
- '#markup' => t('To continue, provide your server connection details'),
+ '#markup' => $this->t('To continue, provide your server connection details'),
'#suffix' => '
',
);
$form['connection_settings']['#tree'] = TRUE;
$form['connection_settings']['authorize_filetransfer_default'] = array(
'#type' => 'select',
- '#title' => t('Connection method'),
+ '#title' => $this->t('Connection method'),
'#default_value' => $authorize_filetransfer_default,
'#weight' => -10,
);
@@ -77,14 +77,14 @@ public function buildForm(array $form, array &$form_state) {
'#prefix' => "
",
'#name' => 'enter_connection_settings',
'#type' => 'submit',
- '#value' => t('Enter connection settings'),
+ '#value' => $this->t('Enter connection settings'),
'#weight' => 100,
);
$form['submit_process'] = array(
'#name' => 'process_updates',
'#type' => 'submit',
- '#value' => t('Continue'),
+ '#value' => $this->t('Continue'),
'#weight' => 100,
);
@@ -103,7 +103,7 @@ public function buildForm(array $form, array &$form_state) {
// We can't use #prefix on the container itself since then the header won't
// be hidden and shown when the containers are being manipulated via JS.
$form['connection_settings'][$name]['header'] = array(
- '#markup' => '' . t('@backend connection settings', array('@backend' => $backend['title'])) . '
',
+ '#markup' => '' . $this->t('@backend connection settings', array('@backend' => $backend['title'])) . '
',
);
$form['connection_settings'][$name] += $this->addConnectionSettings($name);
@@ -124,7 +124,7 @@ public function buildForm(array $form, array &$form_state) {
$form['connection_settings']['change_connection_type'] = array(
'#name' => 'change_connection_type',
'#type' => 'submit',
- '#value' => t('Change connection type'),
+ '#value' => $this->t('Change connection type'),
'#weight' => -5,
'#attributes' => array('class' => array('filetransfer-change-connection-type')),
);
@@ -149,14 +149,14 @@ public function validateForm(array &$form, array &$form_state) {
$filetransfer = $this->getFiletransfer($backend, $form_state['values']['connection_settings'][$backend]);
try {
if (!$filetransfer) {
- throw new \Exception(t('The connection protocol %backend does not exist.', array('%backend' => $backend)));
+ throw new \Exception($this->t('The connection protocol %backend does not exist.', array('%backend' => $backend)));
}
$filetransfer->connect();
}
catch (\Exception $e) {
// The format of this error message is similar to that used on the
// database connection form in the installer.
- form_set_error('connection_settings', t('Failed to connect to the server. The server reports the following message: !message For more help installing or updating code on your server, see the handbook.', array(
+ form_set_error('connection_settings', $this->t('Failed to connect to the server. The server reports the following message: !message For more help installing or updating code on your server, see the handbook.', array(
'!message' => '' . $e->getMessage() . '
',
'@handbook_url' => 'http://drupal.org/documentation/install/modules-themes',
)));