Commit e6dba072 authored by ErikHommel's avatar ErikHommel

wip documentation my email prefs

parent fce5a814
......@@ -79,12 +79,9 @@ If you click on the action select box you will get a list of actions that are al
As time goes by and more people start using and enhancing the [**Action Provider** extension][actionproviderrepo], the list will grow.
!!! Note "Create your own"
It is possible to develop your own specific actions, or indeed generic ones that others can use too! Check the relevant sections in this guide:
It is possible to develop your own specific actions, or indeed generic ones that others can use too! Check the relevant sections in [Example of Email Preferences](email-preferences.md)
* [Introduction to creating your own](create-your-own-introduction.md)
* [Example of Email Preferences](email-preferences.md)
In this example we have a first step: find the contact with the data from the form:
In this example we have a first step: find the contact with the data from the form.
![Find contact action](/images/action-find-contact.png)
......
......@@ -118,7 +118,7 @@ The first step is create a class in my extension extending the *AbstractAction*
````php
<?php
namespace Civi\Myemailprefs\Action;
namespace Civ**i\Myemailprefs\Actions;
use \Civi\ActionProvider\Action\AbstractAction;
use \Civi\ActionProvider\Parameter\ParameterBagInterface;
......@@ -146,14 +146,25 @@ public function getParameterSpecification() {
]);
}
```
The method *getConfigurationSpecification* determines what data I will output in my action.
The method *getConfigurationSpecification* is not really needed here because I have no configuration to set. But I do need this function in my class (as specified in the abstract class) so I make it 'void':
````php
/**
* @return SpecificationBag|void
*/
public function getConfigurationSpecification() {
return new SpecificationBag();
}
````
The method *getOutputSpecification* determines what data I will output in my action.
In this case this will be the flags that correspond to my group memberships and the fields on my form processor:
```php
/**
* @return SpecificationBag
*/
public function getConfigurationSpecification() {
public function getOutputSpecification() {
return new SpecificationBag([
new Specification('newsletter_and_action', 'Boolean', E::ts('Monthly Newsletter and Monthly Action'), FALSE),
new Specification('newsletter_only', 'Boolean', E::ts('Monthly Newsletter Only'), FALSE),
......@@ -161,6 +172,7 @@ public function getConfigurationSpecification() {
new Specification('no_general_mail', 'Boolean', E::ts('No General Mails'), FALSE),
]);
}
```
The method *doAction* actually performs my action, so in this case use the contact_id to retrieve the group memberships and set my booleans reflecting this:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment