modxcms / docs

7 stars 9 forks source link

[Edit Suggestion] FormIt.Hooks.redirect #132

Closed Finetuned closed 8 years ago

Finetuned commented 8 years ago

Page Title

FormIt.Hooks.redirect

URL

https://rtfm.modx.com/extras/revo/formit/formit.hooks/formit.hooks.redirect

Issue or Suggestion

It's unclear about how to dynamically set the redirectTo parameter from a hook and there are misleading and overly complicated solutions in the forum. The following is the simplest way to set the parameter from a hook:

$hook->formit->setOption('redirectTo',$resourceId);
sottwell commented 8 years ago

This would equally apply to any hook's properties. Just remember that the hooks are processed in order, so your hook needs to be listed before the one it's changing.

Finetuned commented 8 years ago

As @Jako pointed out on the Slack channel, this is already documented on https://rtfm.modx.com/extras/revo/formit/formit.hooks although a direct access example is provided.