Skip to content
Snippets Groups Projects
Commit 8ee32cf1 authored by ErikHommel's avatar ErikHommel :homes:
Browse files

wip documentation

parent a8700c09
No related branches found
No related tags found
No related merge requests found
# Create Your Own # Create Your Own
As the combination of the **Form Processor** extension and the **Action Provider** extension really is a framework it is relatively easy to develop your own actions.
This could be necessary because:
* the current set of actions is limited to what we needed initially and it could well be that you need an action that is not there but will be very useful to others as well.
This probably means you want to develop a new action in the **Action Provider** extension (with a pull request).
* you need to develop a very specific action which is only meaningful for the organisation/project you are working with.
In this case you will probably create your specific action in your own extension.
!!! Note
The **Action Provider** is a separate extension rather than part of the **Form Processor** because it can also be used by other extensions (at the moment the [Data Processor extension][dataprocessor]).
[dataprocessor]:https://civicrm.org/extensions/data-processor
# Example of a basic form to sign up for a newsletter # Example of a basic form to sign up for a newsletter
This example details how to create a form on my public website where a visitor can enter *first name, last name and email* and click to sign up for our monhtly newsletter.
The **Form Processor** extension will make sure this is processed in the CiviCRM backend.
The public website is on another server than CiviCRM and I am using Drupal 7 on my public website example.
## Defining the form processor
The general information for my form processor looks like this:
![Form Processor General](/images/newsletter-general-fp.png)
On my form processor I will accept 3 inputs: first name, last name and email.
The email will be validated (is it a valid email?).
![Form Processor Inputs](/images/newsletter-input-fp.png)
Once the form is sent from the public website I would like the following to happen:
* check if we already have a contact with the email entered and if so, use that contact
* if there is no contact with the email yet, create a new contact with the email, first and last name from the form
* add the found or created contact to our newsletter group
So here is what the actions look like:
![Form Processor Actions](/images/newsletter-actions-fp.png)
The action to find or create the contact has been specified so:
![Action to Find or Create Contact](/images/newsletter-find-action.png)
Finally in the action to add the contact to the group I have selected the group the contact should be added to and specified that the contact ID found in the find action should be used.
![Action to Add to Group](/images/newsletter-group-action.png)
## Testing the form processor with the api explorer
Once I have specified my form processor I can test if it works as I would expect.
The form processor generates an API action for the API entity FormProcessor so I can use the API Explorer (Support>Developer>Api Explorer v3) to test if it works.
In this case this is what I will enter:
![Test with API Explorer](/images/newsletter-api-test.png)
And if I then click on **Execute** it should actually add or find the contact and add him/her to the newsletter group.
## Defining the form in Drupal 7
### CiviMRF profile
### CiviMRF for the form
### Adding the fields on the form
### The end result of the form
## Result!
images/newsletter-actions-fp.png

49.8 KiB

images/newsletter-api-test.png

96.9 KiB

images/newsletter-find-action.png

46.8 KiB

images/newsletter-form-fields-message.png

99.2 KiB

images/newsletter-general-fp.png

66 KiB

images/newsletter-group-action.png

42.5 KiB

images/newsletter-inputs-fp.png

28.1 KiB

images/output-handler.png

15.3 KiB | W: | H:

images/output-handler.png

14.5 KiB | W: | H:

images/output-handler.png
images/output-handler.png
images/output-handler.png
images/output-handler.png
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment