Commit bcfa5a47 authored by jaapjansma's avatar jaapjansma

added generic action for set value.

parent cd2bc1aa
<?php
/**
* @author Jaap Jansma <jaap.jansma@civicoop.org>
* @license AGPL-3.0
*/
namespace Civi\ActionProvider\Action\Generic;
use \Civi\ActionProvider\Action\AbstractAction;
use \Civi\ActionProvider\Parameter\ParameterBagInterface;
use \Civi\ActionProvider\Parameter\SpecificationBag;
use \Civi\ActionProvider\Parameter\Specification;
use \Civi\ActionProvider\Utils\CustomField;
use CRM_ActionProvider_ExtensionUtil as E;
class SetValue extends AbstractAction {
/**
* Returns the human readable title of this action
*/
public function getTitle() {
return E::ts('Set value');
}
/**
* Returns the specification of the configuration options for the actual action.
*
* @return SpecificationBag
*/
public function getConfigurationSpecification() {
return new SpecificationBag(array(
new Specification('value', 'String', E::ts('Value'), true),
));
}
/**
* Returns the specification of the configuration options for the actual action.
*
* @return SpecificationBag
* @throws \Exception
*/
public function getParameterSpecification() {
return new SpecificationBag();
}
/**
* Returns the specification of the output parameters of this action.
*
* This function could be overriden by child classes.
*
* @return SpecificationBag
*/
public function getOutputSpecification() {
return new SpecificationBag(array(
new Specification('value', 'String', E::ts('Value')),
));
}
/**
* Run the action
*
* @param ParameterBagInterface $parameters
* The parameters to this action.
* @param ParameterBagInterface $output
* The parameters this action can send back
* @return void
* @throws \Exception
*/
protected function doAction(ParameterBagInterface $parameters, ParameterBagInterface $output) {
$output->setParameter('value', $this->configuration->getParameter('value'));
}
/**
* Returns the tags for this action.
*/
public function getTags() {
return array(
AbstractAction::DATA_MANIPULATION_TAG
);
}
}
\ No newline at end of file
......@@ -13,7 +13,6 @@ use \Civi\ActionProvider\Parameter\Specification;
use \Civi\ActionProvider\Utils\CustomField;
use CRM_ActionProvider_ExtensionUtil as E;
use Dompdf\Exception;
class CreateRelationship extends AbstractAction {
......
......@@ -39,6 +39,7 @@ class Provider {
public function __construct() {
$actions = array(
new \Civi\ActionProvider\Action\Generic\SetValue(),
new \Civi\ActionProvider\Action\AddToGroup(),
new \Civi\ActionProvider\Action\Contact\ContactDataById(),
new \Civi\ActionProvider\Action\Contact\CreateUpdateAddress(),
......
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