Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/www/core/model/modx/processors/security/forms/set/ |
<?php /** * Duplicate a FC Set * * @package modx * @subpackage processors.security.forms.set */ class modFormCustomizationSetDuplicateProcessor extends modObjectDuplicateProcessor { public $classKey = 'modFormCustomizationSet'; public $languageTopics = array('formcustomization'); public $permission = 'customize_forms'; public $objectType = 'profile'; public $checkSavePermission = false; public function beforeSave() { $this->newObject->set('constraint_class','modResource'); $this->newObject->set('active',false); return parent::beforeSave(); } public function afterSave() { $this->duplicateRules(); return parent::afterSave(); } /** * Duplicate all the old rules * @return void */ public function duplicateRules() { $rules = $this->object->getMany('Rules'); /** @var modActionDom $rule */ foreach ($rules as $rule) { /** @var modActionDom $newRule */ $newRule = $this->modx->newObject('modActionDom'); $newRule->fromArray($rule->toArray()); $newRule->set('set',$this->newObject->get('id')); $newRule->save(); } } } return 'modFormCustomizationSetDuplicateProcessor';