summaryrefslogtreecommitdiffstats
path: root/core/modules/language/src/LanguageListBuilder.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/language/src/LanguageListBuilder.php')
-rw-r--r--core/modules/language/src/LanguageListBuilder.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/core/modules/language/src/LanguageListBuilder.php b/core/modules/language/src/LanguageListBuilder.php
index 8d15152..21ef6ff 100644
--- a/core/modules/language/src/LanguageListBuilder.php
+++ b/core/modules/language/src/LanguageListBuilder.php
@@ -9,6 +9,7 @@ use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Language\LanguageManagerInterface;
+use Drupal\Core\Messenger\MessengerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -38,6 +39,13 @@ class LanguageListBuilder extends DraggableListBuilder {
protected $configFactory;
/**
+ * The messenger.
+ *
+ * @var \Drupal\Core\Messenger\MessengerInterface
+ */
+ protected $messenger;
+
+ /**
* {@inheritdoc}
*/
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
@@ -45,7 +53,8 @@ class LanguageListBuilder extends DraggableListBuilder {
$entity_type,
$container->get('entity.manager')->getStorage($entity_type->id()),
$container->get('language_manager'),
- $container->get('config.factory')
+ $container->get('config.factory'),
+ $container->get('messenger')
);
}
@@ -60,11 +69,14 @@ class LanguageListBuilder extends DraggableListBuilder {
* The language manager.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects.
+ * @param \Drupal\Core\Messenger\MessengerInterface $messenger
+ * The messenger.
*/
- public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory) {
+ public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, MessengerInterface $messenger) {
parent::__construct($entity_type, $storage);
$this->languageManager = $language_manager;
$this->configFactory = $config_factory;
+ $this->messenger = $messenger;
}
/**
@@ -154,7 +166,7 @@ class LanguageListBuilder extends DraggableListBuilder {
$this->languageManager->updateLockedLanguageWeights();
}
- drupal_set_message(t('Configuration saved.'));
+ $this->messenger->addStatus($this->t('Configuration saved.'));
// Force the redirection to the page with the language we have just
// selected as default.
$form_state->setRedirectUrl($this->entities[$new_id]->urlInfo('collection', ['language' => $this->entities[$new_id]]));