From e0f50130dece8613408936f10919c2ae3d10f2ad Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 17 Oct 2018 19:05:55 +0200 Subject: [PATCH] Add missing validation that media provider requires html or class name See #2545 --- ...diaProviderPackageInstallationPlugin.class.php | 15 ++++++++++++++- wcfsetup/install/lang/en.xml | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/system/package/plugin/MediaProviderPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/MediaProviderPackageInstallationPlugin.class.php index 46ee6dbf1c..584e23aae9 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/MediaProviderPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/MediaProviderPackageInstallationPlugin.class.php @@ -161,7 +161,7 @@ class MediaProviderPackageInstallationPlugin extends AbstractXMLPackageInstallat MultilineTextFormField::create('html') ->label('wcf.acp.pip.mediaProvider.html') ->description('wcf.acp.pip.mediaProvider.html.description') - ->addValidator(new FormFieldValidator('noClassName', function(MultilineTextFormField $formField) { + ->addValidator(new FormFieldValidator('className', function(MultilineTextFormField $formField) { /** @var ClassNameFormField $className */ $className = $formField->getDocument()->getNodeById('className'); @@ -174,6 +174,19 @@ class MediaProviderPackageInstallationPlugin extends AbstractXMLPackageInstallat ); } })) + ->addValidator(new FormFieldValidator('noClassName', function(MultilineTextFormField $formField) { + /** @var ClassNameFormField $className */ + $className = $formField->getDocument()->getNodeById('className'); + + if ($formField->getSaveValue() === '' && $className->getSaveValue() === '') { + $formField->addValidationError( + new FormFieldValidationError( + 'noClassName', + 'wcf.acp.pip.mediaProvider.html.error.noClassName' + ) + ); + } + })) ]); } diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index fa67d4a028..727ca31f13 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -1947,7 +1947,8 @@ If you have already bought the licenses for the listed apps, th {literal}{$name}{/literal} where name is the name of the group.]]> - + + {$segment}{else}(empty){/if} (segment {#$segmentNumber + 1}){/implode}.]]> -- 2.20.1