From afcf1e17b9457b0fa9e11dee6e58109c235c616f Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 11 Jul 2019 14:50:58 +0200 Subject: [PATCH] Move environment field up in template listener GUI As the environment field influences the template name selection, it should be shown above the template name selection. --- ...istenerPackageInstallationPlugin.class.php | 131 +++++++++--------- 1 file changed, 66 insertions(+), 65 deletions(-) diff --git a/wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php index f9137da65c..669a2b4b9a 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php @@ -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') -- 2.20.1