Move environment field up in template listener GUI
authorMatthias Schmidt <gravatronics@live.com>
Thu, 11 Jul 2019 12:50:58 +0000 (14:50 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 11 Jul 2019 12:50:58 +0000 (14:50 +0200)
As the environment field influences the template name selection, it should be shown above the template name selection.

wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php

index f9137da65caebb1b106654b6c8db37d339bb2405..669a2b4b9abbbc2d363568aed5485ada971dd0d2 100644 (file)
@@ -209,70 +209,6 @@ class TemplateListenerPackageInstallationPlugin extends AbstractXMLPackageInstal
                                        }
                                })),
                        
-                       SingleSelectionFormField::create('frontendTemplateName')
-                               ->objectProperty('templatename')
-                               ->label('wcf.acp.pip.templateListener.templateName')
-                               ->description('wcf.acp.pip.templateListener.templateName.description')
-                               ->required()
-                               ->options(array_combine(array_keys($templateEvents), array_keys($templateEvents)))
-                               ->filterable()
-                               ->addDependency(
-                                       ValueFormFieldDependency::create('environment')
-                                               ->fieldId('environment')
-                                               ->values(['user'])
-                               ),
-                       
-                       SingleSelectionFormField::create('acpTemplateName')
-                               ->objectProperty('templatename')
-                               ->label('wcf.acp.pip.templateListener.templateName')
-                               ->description('wcf.acp.pip.templateListener.templateName.description')
-                               ->required()
-                               ->options(array_combine(array_keys($acpTemplateEvents), array_keys($acpTemplateEvents)))
-                               ->filterable()
-                               ->addDependency(
-                                       ValueFormFieldDependency::create('environment')
-                                               ->fieldId('environment')
-                                               ->values(['admin'])
-                               )
-               ]);
-               
-               /** @var SingleSelectionFormField $frontendTemplateName */
-               $frontendTemplateName = $form->getNodeById('frontendTemplateName');
-               foreach ($templateEvents as $templateName => $events) {
-                       $dataContainer->appendChild(
-                               SingleSelectionFormField::create($templateName . '_eventName')
-                                       ->objectProperty('eventname')
-                                       ->label('wcf.acp.pip.templateListener.eventName')
-                                       ->description('wcf.acp.pip.templateListener.eventName.description')
-                                       ->required()
-                                       ->options(array_combine($events, $events))
-                                       ->addDependency(
-                                               ValueFormFieldDependency::create('templateName')
-                                                       ->field($frontendTemplateName)
-                                                       ->values([$templateName])
-                                       )
-                       );
-               }
-               
-               /** @var SingleSelectionFormField $acpTemplateName */
-               $acpTemplateName = $form->getNodeById('acpTemplateName');
-               foreach ($acpTemplateEvents as $templateName => $events) {
-                       $dataContainer->appendChild(
-                               SingleSelectionFormField::create('acp_' . $templateName . '_eventName')
-                                       ->objectProperty('eventname')
-                                       ->label('wcf.acp.pip.templateListener.eventName')
-                                       ->description('wcf.acp.pip.templateListener.eventName.description')
-                                       ->required()
-                                       ->options(array_combine($events, $events))
-                                       ->addDependency(
-                                               ValueFormFieldDependency::create('acpTemplateName')
-                                                       ->field($acpTemplateName)
-                                                       ->values([$templateName])
-                                       )
-                       );
-               }
-               
-               $dataContainer->appendChildren([
                        SingleSelectionFormField::create('environment')
                                ->label('wcf.acp.pip.templateListener.environment')
                                ->description('wcf.acp.pip.templateListener.environment.description')
@@ -317,7 +253,8 @@ class TemplateListenerPackageInstallationPlugin extends AbstractXMLPackageInstal
                                                        
                                                        /** @var SingleSelectionFormField $eventNameField */
                                                        $eventNameField = $formField->getDocument()->getNodeById('acp_' . $templateNameField->getSaveValue() . '_eventName');
-                                               } else {
+                                               }
+                                               else {
                                                        /** @var SingleSelectionFormField $templateNameField */
                                                        $templateNameField = $formField->getDocument()->getNodeById('frontendTemplateName');
                                                        
@@ -343,6 +280,70 @@ class TemplateListenerPackageInstallationPlugin extends AbstractXMLPackageInstal
                                        }
                                })),
                        
+                       SingleSelectionFormField::create('frontendTemplateName')
+                               ->objectProperty('templatename')
+                               ->label('wcf.acp.pip.templateListener.templateName')
+                               ->description('wcf.acp.pip.templateListener.templateName.description')
+                               ->required()
+                               ->options(array_combine(array_keys($templateEvents), array_keys($templateEvents)))
+                               ->filterable()
+                               ->addDependency(
+                                       ValueFormFieldDependency::create('environment')
+                                               ->fieldId('environment')
+                                               ->values(['user'])
+                               ),
+                       
+                       SingleSelectionFormField::create('acpTemplateName')
+                               ->objectProperty('templatename')
+                               ->label('wcf.acp.pip.templateListener.templateName')
+                               ->description('wcf.acp.pip.templateListener.templateName.description')
+                               ->required()
+                               ->options(array_combine(array_keys($acpTemplateEvents), array_keys($acpTemplateEvents)))
+                               ->filterable()
+                               ->addDependency(
+                                       ValueFormFieldDependency::create('environment')
+                                               ->fieldId('environment')
+                                               ->values(['admin'])
+                               )
+               ]);
+               
+               /** @var SingleSelectionFormField $frontendTemplateName */
+               $frontendTemplateName = $form->getNodeById('frontendTemplateName');
+               foreach ($templateEvents as $templateName => $events) {
+                       $dataContainer->appendChild(
+                               SingleSelectionFormField::create($templateName . '_eventName')
+                                       ->objectProperty('eventname')
+                                       ->label('wcf.acp.pip.templateListener.eventName')
+                                       ->description('wcf.acp.pip.templateListener.eventName.description')
+                                       ->required()
+                                       ->options(array_combine($events, $events))
+                                       ->addDependency(
+                                               ValueFormFieldDependency::create('templateName')
+                                                       ->field($frontendTemplateName)
+                                                       ->values([$templateName])
+                                       )
+                       );
+               }
+               
+               /** @var SingleSelectionFormField $acpTemplateName */
+               $acpTemplateName = $form->getNodeById('acpTemplateName');
+               foreach ($acpTemplateEvents as $templateName => $events) {
+                       $dataContainer->appendChild(
+                               SingleSelectionFormField::create('acp_' . $templateName . '_eventName')
+                                       ->objectProperty('eventname')
+                                       ->label('wcf.acp.pip.templateListener.eventName')
+                                       ->description('wcf.acp.pip.templateListener.eventName.description')
+                                       ->required()
+                                       ->options(array_combine($events, $events))
+                                       ->addDependency(
+                                               ValueFormFieldDependency::create('acpTemplateName')
+                                                       ->field($acpTemplateName)
+                                                       ->values([$templateName])
+                                       )
+                       );
+               }
+               
+               $dataContainer->appendChildren([
                        MultilineTextFormField::create('templateCode')
                                ->objectProperty('templatecode')
                                ->label('wcf.acp.pip.templateListener.templateCode')