summaryrefslogtreecommitdiffstats
path: root/core/modules/user/src/RoleListBuilder.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/user/src/RoleListBuilder.php')
-rw-r--r--core/modules/user/src/RoleListBuilder.php41
1 files changed, 40 insertions, 1 deletions
diff --git a/core/modules/user/src/RoleListBuilder.php b/core/modules/user/src/RoleListBuilder.php
index aa3b844..306677a 100644
--- a/core/modules/user/src/RoleListBuilder.php
+++ b/core/modules/user/src/RoleListBuilder.php
@@ -4,7 +4,11 @@ namespace Drupal\user;
use Drupal\Core\Config\Entity\DraggableListBuilder;
use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Messenger\MessengerInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Defines a class to build a listing of user role entities.
@@ -14,6 +18,41 @@ use Drupal\Core\Form\FormStateInterface;
class RoleListBuilder extends DraggableListBuilder {
/**
+ * The messenger.
+ *
+ * @var \Drupal\Core\Messenger\MessengerInterface
+ */
+ protected $messenger;
+
+ /**
+ * RoleListBuilder constructor.
+ *
+ * @param \Drupal\Core\Entity\EntityTypeInterface $entityType
+ * The entity type definition.
+ * @param \Drupal\Core\Entity\EntityStorageInterface $storage
+ * The entity storage class.
+ * @param \Drupal\Core\Messenger\MessengerInterface $messenger
+ * The messenger.
+ */
+ public function __construct(EntityTypeInterface $entityType,
+ EntityStorageInterface $storage,
+ MessengerInterface $messenger) {
+ parent::__construct($entityType, $storage);
+ $this->messenger = $messenger;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
+ return new static(
+ $entity_type,
+ $container->get('entity.manager')->getStorage($entity_type->id()),
+ $container->get('messenger')
+ );
+ }
+
+ /**
* {@inheritdoc}
*/
public function getFormId() {
@@ -58,7 +97,7 @@ class RoleListBuilder extends DraggableListBuilder {
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
- drupal_set_message(t('The role settings have been updated.'));
+ $this->messenger->addStatus($this->t('The role settings have been updated.'));
}
}