Accessing the current local in form event listener #4590
-
Hi EnvironmentThis is my current Statamic Setup:
ProblemThe The Since I'm in a form event the current URI is always starting with Working solutionA working solution will be to add a field in the form and use the submission event to retreave the data. QuestionWhat will be the best solution to get the current local in a form event class. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi Simon, from what I see it's not possible at this moment. The site would probably need to be passed inside the SubmissionCreated event here so you can use the site's locale. |
Beta Was this translation helpful? Give feedback.
-
You could do this: $site = Statamic\Facades\Site::findByUrl(url()->previous()) It probably won't work if you're using a queued listener though. Ideally, we'd pass the site in the event, like @jelleroorda said. |
Beta Was this translation helpful? Give feedback.
You could do this:
It probably won't work if you're using a queued listener though.
Ideally, we'd pass the site in the event, like @jelleroorda said.