简体   繁体   中英

Drupal 8 - Alter session variable without redirecting the page

I'm looking for a solution to change a Drupal Session Variable ( PrivateTempStoreFactory ) without redirecting to another page. I can accomplish altering the variable by using routing.yml in my module, but this is not a solution that is effective as it changes to a different path.

Simply put, I am trying to create a Role menu in which a User can select an available role that has been assigned to them. When they select a role, their role should be updated in the session and redirected back to the page they started the action ( Menu and other things may change, hence the page needs to be reloaded).

Any help would be appreciated! I'm learning Drupal 8 and it's been quite the curve!

Ended up utilizing the Drupal Ajax API where the callback would use a location.reload(). Problem Solved

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM