Add alternative object action name `AbstractFormBuilderForm`
authorMatthias Schmidt <gravatronics@live.com>
Tue, 14 Aug 2018 17:46:06 +0000 (19:46 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 14 Aug 2018 17:46:06 +0000 (19:46 +0200)
… to support additional action names.

See #2509

wcfsetup/install/files/lib/form/AbstractFormBuilderForm.class.php

index 6843cfaef703380a4aa3a3bc9656af7806228d59..bd314564a5e3545cf4d26238397dca6e432d43ba 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\form;
+use wcf\data\AbstractDatabaseObjectAction;
 use wcf\data\IStorableObject;
 use wcf\system\event\EventHandler;
 use wcf\system\exception\UserInputException;
@@ -38,6 +39,13 @@ abstract class AbstractFormBuilderForm extends AbstractForm {
         */
        public $formObject;
        
+       /**
+        * name of the object action performing the form action
+        * if not set, `$formAction` is sued
+        * @var null|string
+        */
+       public $objectActionName;
+       
        /**
         * name of the object action class performing the form action
         * @var string
@@ -128,7 +136,12 @@ abstract class AbstractFormBuilderForm extends AbstractForm {
        public function save() {
                parent::save();
                
-               $this->objectAction = new $this->objectActionClass(array_filter([$this->formObject]), $this->formAction, $this->form->getData());
+               /** @var AbstractDatabaseObjectAction objectAction */
+               $this->objectAction = new $this->objectActionClass(
+                       array_filter([$this->formObject]),
+                       $this->objectActionName ?: $this->formAction,
+                       $this->form->getData()
+               );
                $this->objectAction->executeAction();
                
                $this->saved();