简体   繁体   English

Drupal 8-更改会话变量而无需重定向页面

[英]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. 我正在寻找一种解决方案,以更改Drupal会话变量( PrivateTempStoreFactory ),而无需重定向到另一个页面。 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. 我可以通过在模块中使用routing.yml来完成变量的更改,但这并不是一种有效的解决方案,因为它更改为其他路径。

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. 简而言之,我试图创建一个“ Role菜单, User可以在其中选择已分配给他们的可用角色。 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). 当他们选择角色时,应在会话中更新他们的角色,并将其重定向回他们开始操作的页面( Menu和其他内容可能会更改,因此需要重新加载页面)。

Any help would be appreciated! 任何帮助,将不胜感激! I'm learning Drupal 8 and it's been quite the curve! 我正在学习Drupal 8,这相当困难!

Ended up utilizing the Drupal Ajax API where the callback would use a location.reload(). 最终利用了Drupal Ajax API ,其中回调将使用location.reload()。 Problem Solved 问题解决了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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