Skip to content
Snippets Groups Projects
Commit 1f365c93 authored by Ide Braakman's avatar Ide Braakman Committed by Sascha Grossenbacher
Browse files

Issue #2958704 by idebr, nkoporec, thalles, Prashant.c: Replace usages of the...

Issue #2958704 by idebr, nkoporec, thalles, Prashant.c: Replace usages of the deprecated drupal_set_message() function
parent a4d28786
No related branches found
No related tags found
No related merge requests found
......@@ -67,7 +67,7 @@ class Fix404IgnoreController extends ControllerBase {
if (empty($ignored_paths) || !strpos($path, $ignored_paths)) {
$this->redirectStorage->resolveLogRequest($path, $langcode);
drupal_set_message($this->t('Resolved the path %path in the database. Please check the ignored list and save the settings.', [
$this->messenger()->addMessage($this->t('Resolved the path %path in the database. Please check the ignored list and save the settings.', [
'%path' => $path,
]));
}
......
......@@ -169,7 +169,7 @@ class Fix404RedirectUITest extends Redirect404TestBase {
$this->drupalPostForm(NULL, $edit, 'Save configuration');
// Should redirect to 'Fix 404'. Check the 404 entry is not shown anymore.
$this->assertUrl('admin/config/search/redirect/404');
$this->assertText('Configuration was saved.');
$this->assertText('The configuration options have been saved.');
$this->assertNoText('node/' . $node2->id() . '/test');
$this->assertText('There are no 404 errors to fix.');
......
......@@ -160,6 +160,6 @@ class RedirectDomainForm extends ConfigFormBase {
}
$domain_config->set('domain_redirects', $domain_redirects);
$domain_config->save();
drupal_set_message($this->t('The domain redirects have been saved.'));
$this->messenger()->addMessage($this->t('The domain redirects have been saved.'));
}
}
......@@ -165,13 +165,13 @@ function redirect_generate_batch_generate($num, array &$context) {
function redirect_generate_batch_finished($success, $results, $operations) {
if ($success) {
drupal_set_message(\Drupal::translation()->formatPlural(count($results), 'One URL redirect created.', '@count URL redirects created.'));
\Drupal::messenger()->addMessage(\Drupal::translation()->formatPlural(count($results), 'One URL redirect created.', '@count URL redirects created.'));
}
else {
// An error occurred.
// $operations contains the operations that remained unprocessed.
$error_operation = reset($operations);
drupal_set_message(t('An error occurred while processing @operation with arguments : @args', ['@operation' => $error_operation[0], '@args' => print_r($error_operation[0], TRUE)]));
\Drupal::messenger()->addMessage(t('An error occurred while processing @operation with arguments : @args', ['@operation' => $error_operation[0], '@args' => print_r($error_operation[0], TRUE)]));
}
}
......
......@@ -7,3 +7,4 @@ configure: redirect.settings
dependencies:
- drupal:link
- drupal:views
- drupal:system (>= 8.5)
......@@ -34,7 +34,7 @@ class RedirectDeleteForm extends ContentEntityConfirmFormBase {
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity->delete();
drupal_set_message($this->t('The redirect %redirect has been deleted.', ['%redirect' => $this->entity->getRedirectUrl()->toString()]));
$this->messenger()->addMessage($this->t('The redirect %redirect has been deleted.', ['%redirect' => $this->entity->getRedirectUrl()->toString()]));
$form_state->setRedirect('redirect.list');
}
......
......@@ -132,7 +132,7 @@ class RedirectDeleteMultipleForm extends ConfirmFormBase {
$this->privateTempStoreFactory->get('redirect_multiple_delete_confirm')->delete($this->currentUser->id());
$count = count($this->redirects);
$this->logger('redirect')->notice('Deleted @count redirects.', ['@count' => $count]);
drupal_set_message($this->stringTranslation->formatPlural($count, 'Deleted 1 redirect.', 'Deleted @count redirects.'));
$this->messenger()->addMessage($this->stringTranslation->formatPlural($count, 'Deleted 1 redirect.', 'Deleted @count redirects.'));
}
$form_state->setRedirect('redirect.list');
}
......
......@@ -50,7 +50,7 @@ class RedirectForm extends ContentEntityForm {
$redirect->setRedirect($redirect_url, $redirect_query, $redirect_options);
}
catch (MatchingRouteNotFoundException $e) {
drupal_set_message($this->t('Invalid redirect URL %url provided.', ['%url' => $redirect_url]), 'warning');
$this->messenger()->addMessage($this->t('Invalid redirect URL %url provided.', ['%url' => $redirect_url]), 'warning');
}
}
......@@ -146,7 +146,7 @@ class RedirectForm extends ContentEntityForm {
*/
public function save(array $form, FormStateInterface $form_state) {
$this->entity->save();
drupal_set_message($this->t('The redirect has been saved.'));
$this->messenger()->addMessage($this->t('The redirect has been saved.'));
$form_state->setRedirect('redirect.list');
}
}
......@@ -87,7 +87,7 @@ class RedirectSettingsForm extends ConfigFormBase {
}
}
$config->save();
drupal_set_message($this->t('Configuration was saved.'));
parent::submitForm($form, $form_state);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment