1

I'm building out a Craft 3 plugin and can't see who to pass variables with redirection from a controller.

For example, I have a controller that I want to pass back to the defined redirect value along with a variable, eg:

return $this->redirectToPostedUrl( ['order' => $order ] );

However, trying to access the order variable within my template is returning empty. The order object definitely exists before the redirection as it can be accessed from within my controller.

Any suggestions appreciated - I'm sure am overlooking something quite straightforward!

  • Is it your own route? If so you can include the parameter to your URL rules or you can store it in the Session – Robin Schambach May 1 '18 at 16:11
  • From digging through docs and code I take it setFlash and getFlash are no longer available? The only flash method I can seem to access are notice and error related – Cole Henley May 1 '18 at 16:22
  • They still exists in the session component – Robin Schambach May 1 '18 at 16:25
  • 1
    But I'd need my own variables to access this at a template level, correct? – Cole Henley May 1 '18 at 16:31
  • What do you mean by "my own variables"? – Robin Schambach May 1 '18 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.