Loading src/Form/AssignUserForm.php +16 −2 Changes for src/Form/AssignUserForm.php: 16 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Core\Session\AccountInterface; use Drupal\Core\Config\Entity\ConfigEntityStorageInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Messenger\MessengerInterface; use Drupal\user\UserInterface; use Drupal\workbench_access\AccessControlHierarchyInterface; use Drupal\workbench_access\RoleSectionStorageInterface; Loading Loading @@ -65,6 +66,13 @@ class AssignUserForm extends FormBase { */ protected $roleSectionStorage; /** * The Drupal messenger service. * * @var \Drupal\Core\Messenger\MessengerInterface */ protected $messenger; /** * Constructs the form object. * Loading @@ -78,13 +86,16 @@ class AssignUserForm extends FormBase { * The user section storage service. * @param \Drupal\workbench_access\RoleSectionStorageInterface $role_section_storage * The role section storage service. * @param \Drupal\Core\Messenger\MessengerInterface $messenger * The Drupal messenger service. */ public function __construct(WorkbenchAccessManagerInterface $manager, ConfigEntityStorageInterface $scheme_storage, SectionAssociationStorageInterface $section_storage, UserSectionStorageInterface $user_section_storage, RoleSectionStorageInterface $role_section_storage) { public function __construct(WorkbenchAccessManagerInterface $manager, ConfigEntityStorageInterface $scheme_storage, SectionAssociationStorageInterface $section_storage, UserSectionStorageInterface $user_section_storage, RoleSectionStorageInterface $role_section_storage, MessengerInterface $messenger) { $this->manager = $manager; $this->schemeStorage = $scheme_storage; $this->sectionStorage = $section_storage; $this->userSectionStorage = $user_section_storage; $this->roleSectionStorage = $role_section_storage; $this->messenger = $messenger; } /** Loading @@ -96,7 +107,8 @@ class AssignUserForm extends FormBase { $container->get('entity_type.manager')->getStorage('access_scheme'), $container->get('entity_type.manager')->getStorage('section_association'), $container->get('workbench_access.user_section_storage'), $container->get('workbench_access.role_section_storage') $container->get('workbench_access.role_section_storage'), $container->get('messenger') ); } Loading Loading @@ -212,6 +224,8 @@ class AssignUserForm extends FormBase { })); $this->userSectionStorage->removeUser($item['scheme'], $this->user, $remove_sections); } $this->messenger()->addMessage($this->t('Section assignments updated successfully.')); } /** Loading Loading
src/Form/AssignUserForm.php +16 −2 Changes for src/Form/AssignUserForm.php: 16 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Core\Session\AccountInterface; use Drupal\Core\Config\Entity\ConfigEntityStorageInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Messenger\MessengerInterface; use Drupal\user\UserInterface; use Drupal\workbench_access\AccessControlHierarchyInterface; use Drupal\workbench_access\RoleSectionStorageInterface; Loading Loading @@ -65,6 +66,13 @@ class AssignUserForm extends FormBase { */ protected $roleSectionStorage; /** * The Drupal messenger service. * * @var \Drupal\Core\Messenger\MessengerInterface */ protected $messenger; /** * Constructs the form object. * Loading @@ -78,13 +86,16 @@ class AssignUserForm extends FormBase { * The user section storage service. * @param \Drupal\workbench_access\RoleSectionStorageInterface $role_section_storage * The role section storage service. * @param \Drupal\Core\Messenger\MessengerInterface $messenger * The Drupal messenger service. */ public function __construct(WorkbenchAccessManagerInterface $manager, ConfigEntityStorageInterface $scheme_storage, SectionAssociationStorageInterface $section_storage, UserSectionStorageInterface $user_section_storage, RoleSectionStorageInterface $role_section_storage) { public function __construct(WorkbenchAccessManagerInterface $manager, ConfigEntityStorageInterface $scheme_storage, SectionAssociationStorageInterface $section_storage, UserSectionStorageInterface $user_section_storage, RoleSectionStorageInterface $role_section_storage, MessengerInterface $messenger) { $this->manager = $manager; $this->schemeStorage = $scheme_storage; $this->sectionStorage = $section_storage; $this->userSectionStorage = $user_section_storage; $this->roleSectionStorage = $role_section_storage; $this->messenger = $messenger; } /** Loading @@ -96,7 +107,8 @@ class AssignUserForm extends FormBase { $container->get('entity_type.manager')->getStorage('access_scheme'), $container->get('entity_type.manager')->getStorage('section_association'), $container->get('workbench_access.user_section_storage'), $container->get('workbench_access.role_section_storage') $container->get('workbench_access.role_section_storage'), $container->get('messenger') ); } Loading Loading @@ -212,6 +224,8 @@ class AssignUserForm extends FormBase { })); $this->userSectionStorage->removeUser($item['scheme'], $this->user, $remove_sections); } $this->messenger()->addMessage($this->t('Section assignments updated successfully.')); } /** Loading