Skip to content
Snippets Groups Projects
Commit b4649a47 authored by Jonathan Hedstrom's avatar Jonathan Hedstrom
Browse files

Issue #3317859 by jhedstrom, adriancid: Have different messages for new and...

Issue #3317859 by jhedstrom, adriancid: Have different messages for new and update message templates
parent 1ae60044
Branches
Tags
1 merge request!15Issue #3317859: Have different messages for new and update message templates
......@@ -183,13 +183,19 @@ class MessageTemplateForm extends EntityForm {
}, $text);
$this->entity->set('text', $text);
$new = $this->entity->isNew();
parent::save($form, $form_state);
$params = [
'@template' => $form_state->getValue('label'),
'%template' => $form_state->getValue('label'),
];
$this->messenger()->addMessage($this->t('The message template @template created successfully.', $params));
if ($new) {
$this->messenger()->addMessage($this->t('The message template %template created successfully.', $params));
}
else {
$this->messenger()->addMessage($this->t('The message template %template has been updated.', $params));
}
$form_state->setRedirect('message.overview_templates');
return $this->entity;
}
......
......@@ -85,6 +85,7 @@ class MessageTemplateUiTest extends MessageTestBase {
];
$this->drupalGet('admin/structure/message/manage/dummy_message');
$this->submitForm($edit, t('Save message template'));
$this->assertSession()->pageTextContains('The message template Edited Dummy message has been updated.');
$this->drupalGet('admin/structure/message/manage/dummy_message');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment