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('This update is a major version update which means that it may not be backwards compatible with your currently running version. It is recommended that you read the release notes and proceed at your own risk.') . '
'; + $recommended_version .= '
' . $this->t('This update is a major version update which means that it may not be backwards compatible with your currently running version. It is recommended that you read the release notes and proceed at your own risk.') . '
'; } // Create an entry for this project. @@ -150,14 +149,14 @@ public function buildForm(array $form, array &$form_state) { switch ($project['status']) { case UPDATE_NOT_SECURE: case UPDATE_REVOKED: - $entry['title'] .= ' ' . t('(Security update)'); + $entry['title'] .= ' ' . $this->t('(Security update)'); $entry['#weight'] = -2; $type = 'security'; break; case UPDATE_NOT_SUPPORTED: $type = 'unsupported'; - $entry['title'] .= ' ' . t('(Unsupported)'); + $entry['title'] .= ' ' . $this->t('(Unsupported)'); $entry['#weight'] = -1; break; @@ -219,18 +218,18 @@ public function buildForm(array $form, array &$form_state) { if (empty($projects)) { $form['message'] = array( - '#markup' => t('All of your projects are up to date.'), + '#markup' => $this->t('All of your projects are up to date.'), ); return $form; } $headers = array( 'title' => array( - 'data' => t('Name'), + 'data' => $this->t('Name'), 'class' => array('update-project-name'), ), - 'installed_version' => t('Installed version'), - 'recommended_version' => t('Recommended version'), + 'installed_version' => $this->t('Installed version'), + 'recommended_version' => $this->t('Recommended version'), ); if (!empty($projects['enabled'])) { @@ -240,7 +239,7 @@ public function buildForm(array $form, array &$form_state) { '#options' => $projects['enabled'], ); if (!empty($projects['disabled'])) { - $form['projects']['#prefix'] = '

' . t('Enabled') . '

'; + $form['projects']['#prefix'] = '

' . $this->t('Enabled') . '

'; } } @@ -250,7 +249,7 @@ public function buildForm(array $form, array &$form_state) { '#header' => $headers, '#options' => $projects['disabled'], '#weight' => 1, - '#prefix' => '

' . t('Disabled') . '

', + '#prefix' => '

' . $this->t('Disabled') . '

', ); } @@ -260,13 +259,13 @@ public function buildForm(array $form, array &$form_state) { $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', - '#value' => t('Download these updates'), + '#value' => $this->t('Download these updates'), ); } if (!empty($projects['manual'])) { - $prefix = '

' . t('Manual updates required') . '

'; - $prefix .= '

' . t('Updates of Drupal core are not supported at this time.') . '

'; + $prefix = '

' . $this->t('Manual updates required') . '

'; + $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(); } }