From: Matthias Schmidt Date: Thu, 11 Jul 2019 12:50:58 +0000 (+0200) Subject: Move environment field up in template listener GUI X-Git-Tag: 5.2.0_Alpha_2~24 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=afcf1e17b9457b0fa9e11dee6e58109c235c616f;p=GitHub%2FWoltLab%2FWCF.git 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. --- 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')