{"action":"created","issue":{"url":"https://api.github.com/repos/getgrav/grav-plugin-form/issues/29","labels_url":"https://api.github.com/repos/getgrav/grav-plugin-form/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/getgrav/grav-plugin-form/issues/29/comments","events_url":"https://api.github.com/repos/getgrav/grav-plugin-form/issues/29/events","html_url":"https://github.com/getgrav/grav-plugin-form/issues/29","id":122390163,"number":29,"title":"Add Process Type 'Hook'","user":{"login":"sturple","id":5727854,"avatar_url":"https://avatars.githubusercontent.com/u/5727854?v=3","gravatar_id":"","url":"https://api.github.com/users/sturple","html_url":"https://github.com/sturple","followers_url":"https://api.github.com/users/sturple/followers","following_url":"https://api.github.com/users/sturple/following{/other_user}","gists_url":"https://api.github.com/users/sturple/gists{/gist_id}","starred_url":"https://api.github.com/users/sturple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sturple/subscriptions","organizations_url":"https://api.github.com/users/sturple/orgs","repos_url":"https://api.github.com/users/sturple/repos","events_url":"https://api.github.com/users/sturple/events{/privacy}","received_events_url":"https://api.github.com/users/sturple/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/getgrav/grav-plugin-form/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":{"login":"flaviocopes","id":11783388,"avatar_url":"https://avatars.githubusercontent.com/u/11783388?v=3","gravatar_id":"","url":"https://api.github.com/users/flaviocopes","html_url":"https://github.com/flaviocopes","followers_url":"https://api.github.com/users/flaviocopes/followers","following_url":"https://api.github.com/users/flaviocopes/following{/other_user}","gists_url":"https://api.github.com/users/flaviocopes/gists{/gist_id}","starred_url":"https://api.github.com/users/flaviocopes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flaviocopes/subscriptions","organizations_url":"https://api.github.com/users/flaviocopes/orgs","repos_url":"https://api.github.com/users/flaviocopes/repos","events_url":"https://api.github.com/users/flaviocopes/events{/privacy}","received_events_url":"https://api.github.com/users/flaviocopes/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-12-15T23:11:59Z","updated_at":"2015-12-16T06:40:02Z","closed_at":"2015-12-16T06:40:02Z","body":"It would be nice to have a Hook Process to the form. \r\nNot sure of how this would work, Would this have to be in the form of a function in your theme or another plugin\r\nor would it be in the form of a custom function right in the yaml file\r\nor is there somewhere else this could be defined.\r\n\r\nHere are some reasons to add a hook\r\n* Be able to a email list registration, (curl call to another site)\r\n* Save data in a database \r\n* append to a custom file on disk instead of a new file each form submission"},"comment":{"url":"https://api.github.com/repos/getgrav/grav-plugin-form/issues/comments/165015123","html_url":"https://github.com/getgrav/grav-plugin-form/issues/29#issuecomment-165015123","issue_url":"https://api.github.com/repos/getgrav/grav-plugin-form/issues/29","id":165015123,"user":{"login":"flaviocopes","id":11783388,"avatar_url":"https://avatars.githubusercontent.com/u/11783388?v=3","gravatar_id":"","url":"https://api.github.com/users/flaviocopes","html_url":"https://github.com/flaviocopes","followers_url":"https://api.github.com/users/flaviocopes/followers","following_url":"https://api.github.com/users/flaviocopes/following{/other_user}","gists_url":"https://api.github.com/users/flaviocopes/gists{/gist_id}","starred_url":"https://api.github.com/users/flaviocopes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flaviocopes/subscriptions","organizations_url":"https://api.github.com/users/flaviocopes/orgs","repos_url":"https://api.github.com/users/flaviocopes/repos","events_url":"https://api.github.com/users/flaviocopes/events{/privacy}","received_events_url":"https://api.github.com/users/flaviocopes/received_events","type":"User","site_admin":false},"created_at":"2015-12-16T06:40:02Z","updated_at":"2015-12-16T06:40:02Z","body":"This is already possible. \r\nSee http://learn.getgrav.org/advanced/forms#form-actions\r\n\r\nIn the form `process` field add your own processing action name, for example 'saveToDatabase'.\r\n\r\nThen in your plugin listen for the event `onFormProcessed` https://github.com/getgrav/grav-plugin-email/blob/develop/email.php#L22 and provide a handler for the `saveToDatabase` action: https://github.com/getgrav/grav-plugin-email/blob/develop/email.php#L57. \r\n\r\nI posted those links that are from the Email plugin, it sends emails in this way, and you can add any action you can think of in your plugins / themes."}}