Source of file SetPropertyWorkflowAction.php
Size: 0,909 Bytes - Last Modified: 2021-12-24T06:44:28+00:00
/var/www/docs.ssmods.com/process/src/code/actions/SetPropertyWorkflowAction.php
1234567891011121314151617181920212223242526272829303132333435363738394041 | <?php /** * * * @author Marcus Nyeholt <marcus@silverstripe.com.au> */ class SetPropertyWorkflowAction extends WorkflowAction { private static $db = array( 'Property' => 'Varchar', 'Value' => 'Text', ); public function execute(WorkflowInstance $workflow) { if (!$target = $workflow->getTarget()) { return true; } if ($target->hasField($this->Property)) { $target->setField($this->Property, $this->Value); } $target->write(); return true; } public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldsToTab('Root.Main', array( TextField::create('Property', _t('SetPropertyWorkflowAction.PROPERTY', 'Property')) ->setRightTitle(_t('SetPropertyWorkflowAction.PROPERTYTITLE', 'Property to set; if this exists as a setter method, will be called passing the value')), TextField::create('Value', 'Value') )); return $fields; } } |