-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional integrations that trigger built-in craft actions. #1876
Comments
Interesting! So the reason I haven't pursued something like this is that some actions seem overkill to route through Formie, like the login action. We have the save entry/user as part of the Entry/User integration, and the register/login can be done without pointing to Formie. It seemed (to me) a bit overkill to generate a submission based on every time someone logs in, but that's something I suppose can be up to you! Other actions might not be useful in the real-world, this sort of thing starts to delve into actions of other plugins or modules, which could certainly be useful. I think this is a great idea. Whether this becomes a generic "Action" integration (a controller action of your choosing) or just a few common ones like the ones listed above, I'll consider it. I'm leaning towards the former to give people lots of flexibility. |
I like the idea of a generic "Action" integration. That opens up a ton of possibilities. Having a submission for every login might not be useful for everyone, but being able to trigger other actions when the user logs in could be useful. It also keeps all of the form logic in one place, rather than overriding it on the frontend (currently, I have Formie render the login form and override the submit function to post the data to the login action). |
Just another thought. The action triggers should execute before Formie sends the response. This way, the action response data can be included. The current integrations get added to Craft's job queue, which works well, but for an action integration the response data is important. |
Another good point, and ties into how we might go about solving the #1152 issue for something like registering a user where you do need it to run outside of the queue. |
What are you trying to do?
Craft cms has several built-in actions, such as:
Docs
It would be great if we could create integrations in Formie that are mapped to these actions.
What's your proposed solution?
I imagine it would work similarly to the "Entries" integration that Formie has, where a form can trigger the creation of a user or entry.
Using an example from the table above:
users/login
This integration would log the user in and return the res from the login action.
The GQL response could be something like:
We would likely need the ability to map form fields to the action inputs. Using the users/login action as an example:
map an "Email" field to "loginName"
Additional context
The benefits of using a Formie integration instead of a regular POST request to the action include:
The text was updated successfully, but these errors were encountered: