diff --git a/core/modules/update/lib/Drupal/update/Form/UpdateManagerInstall.php b/core/modules/update/lib/Drupal/update/Form/UpdateManagerInstall.php index 4c66499..575f7ac 100644 --- a/core/modules/update/lib/Drupal/update/Form/UpdateManagerInstall.php +++ b/core/modules/update/lib/Drupal/update/Form/UpdateManagerInstall.php @@ -7,17 +7,16 @@ namespace Drupal\update\Form; -use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\FileTransfer\Local; -use Drupal\Core\Form\FormInterface; +use Drupal\Core\Form\FormBase; use Drupal\Core\Updater\Updater; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Configure update settings for this site. */ -class UpdateManagerInstall implements FormInterface, ControllerInterface { +class UpdateManagerInstall extends FormBase { /** * The module handler. @@ -63,7 +62,7 @@ public function buildForm(array $form, array &$form_state) { $form['help_text'] = array( '#prefix' => '
', - '#markup' => t('You can find modules and themes on drupal.org. The following file extensions are supported: %extensions.', array( + '#markup' => $this->t('You can find modules and themes on drupal.org. The following file 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', @@ -74,26 +73,26 @@ public function buildForm(array $form, array &$form_state) { $form['project_url'] = array( '#type' => 'url', - '#title' => t('Install from a URL'), - '#description' => t('For example: %url', array('%url' => 'http://ftp.drupal.org/files/projects/name.tar.gz')), + '#title' => $this->t('Install from a URL'), + '#description' => $this->t('For example: %url', array('%url' => 'http://ftp.drupal.org/files/projects/name.tar.gz')), ); $form['information'] = array( '#prefix' => '', - '#markup' => t('Or'), + '#markup' => $this->t('Or'), '#suffix' => '', ); $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')), + '#title' => $this->t('Upload a module or theme archive to install'), + '#description' => $this->t('For example: %filename from your local computer', array('%filename' => 'name.tar.gz')), ); $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', - '#value' => t('Install'), + '#value' => $this->t('Install'), ); return $form; @@ -104,7 +103,7 @@ public function buildForm(array $form, array &$form_state) { */ public function validateForm(array &$form, array &$form_state) { if (!($form_state['values']['project_url'] XOR !empty($_FILES['files']['name']['project_upload']))) { - form_set_error('project_url', t('You must either provide a URL or upload an archive file to install.')); + form_set_error('project_url', $this->t('You must either provide a URL or upload an archive file to install.')); } } @@ -118,7 +117,7 @@ public function submitForm(array &$form, array &$form_state) { $field = 'project_url'; $local_cache = update_manager_file_get($form_state['values']['project_url']); if (!$local_cache) { - form_set_error($field, t('Unable to retrieve Drupal project from %url.', array('%url' => $form_state['values']['project_url']))); + form_set_error($field, $this->t('Unable to retrieve Drupal project from %url.', array('%url' => $form_state['values']['project_url']))); return; } } @@ -144,7 +143,7 @@ public function submitForm(array &$form, array &$form_state) { $files = $archive->listContents(); if (!$files) { - form_set_error($field, t('Provided archive contains no files.')); + form_set_error($field, $this->t('Provided archive contains no files.')); return; } @@ -187,11 +186,11 @@ public function submitForm(array &$form, array &$form_state) { } if (!$project_title) { - form_set_error($field, t('Unable to determine %project name.', array('%project' => $project))); + form_set_error($field, $this->t('Unable to determine %project name.', array('%project' => $project))); } if ($updater->isInstalled()) { - form_set_error($field, t('%project is already installed.', array('%project' => $project_title))); + form_set_error($field, $this->t('%project is already installed.', array('%project' => $project_title))); return; } @@ -217,7 +216,7 @@ public function submitForm(array &$form, array &$form_state) { // credentials and invoke update_authorize_run_install() indirectly with // whatever FileTransfer object authorize.php creates for us. else { - system_authorized_init('update_authorize_run_install', drupal_get_path('module', 'update') . '/update.authorize.inc', $arguments, t('Update manager')); + system_authorized_init('update_authorize_run_install', drupal_get_path('module', 'update') . '/update.authorize.inc', $arguments, $this->t('Update manager')); $form_state['redirect'] = system_authorized_get_url(); } } diff --git a/core/modules/update/lib/Drupal/update/Form/UpdateManagerUpdate.php b/core/modules/update/lib/Drupal/update/Form/UpdateManagerUpdate.php index 304cc04..6d757b8 100644 --- a/core/modules/update/lib/Drupal/update/Form/UpdateManagerUpdate.php +++ b/core/modules/update/lib/Drupal/update/Form/UpdateManagerUpdate.php @@ -8,16 +8,15 @@ namespace Drupal\update\Form; use Drupal\Component\Utility\String; -use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Form\FormInterface; +use Drupal\Core\Form\FormBase; use Drupal\Core\KeyValueStore\KeyValueStoreInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Configure update settings for this site. */ -class UpdateManagerUpdate implements FormInterface, ControllerInterface { +class UpdateManagerUpdate extends FormBase { /** * The module handler. @@ -84,7 +83,7 @@ public function buildForm(array $form, array &$form_state) { $available = update_get_available(TRUE); if (empty($available)) { $form['message'] = array( - '#markup' => t('There was a problem getting update information. Try again later.'), + '#markup' => $this->t('There was a problem getting update information. Try again later.'), ); return $form; } @@ -125,7 +124,7 @@ public function buildForm(array $form, array &$form_state) { $project_name = String::checkPlain($name); } if ($project['project_type'] == 'theme' || $project['project_type'] == 'theme-disabled') { - $project_name .= ' ' . t('(Theme)'); + $project_name .= ' ' . $this->t('(Theme)'); } if (empty($project['recommended'])) { @@ -135,9 +134,9 @@ public function buildForm(array $form, array &$form_state) { } $recommended_release = $project['releases'][$project['recommended']]; - $recommended_version = $recommended_release['version'] . ' ' . l(t('(Release notes)'), $recommended_release['release_link'], array('attributes' => array('title' => t('Release notes for @project_title', array('@project_title' => $project['title']))))); + $recommended_version = $recommended_release['version'] . ' ' . l($this->t('(Release notes)'), $recommended_release['release_link'], array('attributes' => array('title' => $this->t('Release notes for @project_title', array('@project_title' => $project['title']))))); if ($recommended_release['version_major'] != $project['existing_major']) { - $recommended_version .= '
' . t('Updates of Drupal core are not supported at this time.') . '
'; + $prefix = '' . $this->t('Updates of Drupal core are not supported at this time.') . '
'; $form['manual_updates'] = array( '#theme' => 'table', '#header' => $headers, @@ -290,7 +289,7 @@ public function validateForm(array &$form, array &$form_state) { $disabled = array_filter($form_state['values']['disabled_projects']); } if (empty($enabled) && empty($disabled)) { - form_set_error('projects', t('You must select at least one project to update.')); + form_set_error('projects', $this->t('You must select at least one project to update.')); } } @@ -316,8 +315,8 @@ public function submitForm(array &$form, array &$form_state) { ); } $batch = array( - 'title' => t('Downloading updates'), - 'init_message' => t('Preparing to download selected updates'), + 'title' => $this->t('Downloading updates'), + 'init_message' => $this->t('Preparing to download selected updates'), 'operations' => $operations, 'finished' => 'update_manager_download_batch_finished', 'file' => drupal_get_path('module', 'update') . '/update.manager.inc', diff --git a/core/modules/update/lib/Drupal/update/Form/UpdateReady.php b/core/modules/update/lib/Drupal/update/Form/UpdateReady.php index bfdf2d6..8b922f1 100644 --- a/core/modules/update/lib/Drupal/update/Form/UpdateReady.php +++ b/core/modules/update/lib/Drupal/update/Form/UpdateReady.php @@ -65,7 +65,7 @@ public static function create(ContainerInterface $container) { * {@inheritdoc} */ public function buildForm(array $form, array &$form_state) { - drupal_set_title(t('Ready to update')); + drupal_set_title($this->t('Ready to update')); $this->moduleHandler->loadInclude('update', 'inc', 'update.manager'); if (!_update_manager_check_backends($form, 'update')) { return $form; @@ -73,12 +73,12 @@ public function buildForm(array $form, array &$form_state) { $form['backup'] = array( '#prefix' => '', - '#markup' => t('Back up your database and site before you continue. Learn how.', array('@backup_url' => url('http://drupal.org/node/22281'))), + '#markup' => $this->t('Back up your database and site before you continue. Learn how.', array('@backup_url' => url('http://drupal.org/node/22281'))), '#suffix' => '', ); $form['maintenance_mode'] = array( - '#title' => t('Perform updates with site in maintenance mode (strongly recommended)'), + '#title' => $this->t('Perform updates with site in maintenance mode (strongly recommended)'), '#type' => 'checkbox', '#default_value' => TRUE, ); @@ -86,7 +86,7 @@ public function buildForm(array $form, array &$form_state) { $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', - '#value' => t('Continue'), + '#value' => $this->t('Continue'), ); return parent::buildForm($form, $form_state); @@ -137,7 +137,7 @@ public function submitForm(array &$form, array &$form_state) { // credentials and invoke update_authorize_run_update() indirectly with // whatever FileTransfer object authorize.php creates for us. else { - system_authorized_init('update_authorize_run_update', drupal_get_path('module', 'update') . '/update.authorize.inc', array($updates), t('Update manager')); + system_authorized_init('update_authorize_run_update', drupal_get_path('module', 'update') . '/update.authorize.inc', array($updates), $this->t('Update manager')); $form_state['redirect'] = system_authorized_get_url(); } }