From e3aff618cbabc7b2f1e355b4a604db742c9822bc Mon Sep 17 00:00:00 2001 From: Beatrycze Volk Date: Thu, 15 Oct 2026 16:20:37 +0200 Subject: [PATCH 1/6] [MAINTENANCE] Use controller settings for validation configuration Removes the explicit TypoScript retrieval for validation settings. The controller now uses its already available $this->settings property for this configuration. This change also generalizes the 'domDocumentValidation' access by removing the hardcoded 'dfgviewer' sub-key. --- .../Controller/ValidationFormController.php | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/Classes/Controller/ValidationFormController.php b/Classes/Controller/ValidationFormController.php index ab59106d99..a6cd1ab3d6 100644 --- a/Classes/Controller/ValidationFormController.php +++ b/Classes/Controller/ValidationFormController.php @@ -14,9 +14,6 @@ use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Core\Site\Entity\SiteLanguage; -use TYPO3\CMS\Core\TypoScript\TypoScriptService; -use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; /** * Plugin 'ValidationForm' for the 'dlf' extension @@ -38,20 +35,9 @@ public function mainAction(): ResponseInterface /** @var SiteLanguage $siteLanguage */ $siteLanguage = $this->request->getAttribute('language') ?? $this->request->getAttribute('site')->getDefaultLanguage(); - $typeParam = 'dfgviewer'; - - // retrieve validation configuration from plugin.tx_dlf typoscript - /** @var ConfigurationManagerInterface $configurationManager */ - $configurationManager = GeneralUtility::makeInstance(ConfigurationManagerInterface::class); - $typoScript = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); - - /** @var TypoScriptService $typoScriptService */ - $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class); - $settings = $typoScriptService->convertTypoScriptArrayToPlainArray($typoScript['plugin.']['tx_dlf.']['settings.']); - $disabledValidators = []; - if (array_key_exists("domDocumentValidation", $settings) && array_key_exists($typeParam, $settings["domDocumentValidation"])) { - $validationConfiguration = $settings['domDocumentValidation'][$typeParam]; + if (array_key_exists("domDocumentValidation", $this->settings)) { + $validationConfiguration = $this->settings['domDocumentValidation']; foreach ($validationConfiguration as $key => $value) { if (isset($value['disabled']) && $value['disabled'] === "true") { $disabledValidators[$key]['title'] = $value['title']; From 9c1a0e67d206aaa23b924633c6b70c7c39d90631 Mon Sep 17 00:00:00 2001 From: Beatrycze Volk Date: Mon, 19 Oct 2026 13:38:15 +0200 Subject: [PATCH 2/6] [MAINTENANCE] Generalize validation plugin and externalize configuration to YAML Rename the 'ValidationForm' plugin and its associated files to 'Validation' to better match TYPO3 plugin naming convention. Refactor the validation configuration mechanism by moving validation rules from TypoScript settings into dedicated YAML file. This improves modularity and maintainability by introducing a `YamlConfigurationProvider` for loading configurations, making them more declarative and easier to manage. --- ...ontroller.php => ValidationController.php} | 19 +++--- Classes/Middleware/DOMDocumentValidation.php | 22 ++---- .../YamlConfigurationProvider.php | 68 +++++++++++++++++++ .../{ValidationForm.xml => Validation.xml} | 4 +- Configuration/TCA/Overrides/tt_content.php | 14 ++-- .../TsConfig/ContentElements.tsconfig | 10 +-- Configuration/TypoScript/setup.typoscript | 4 +- Documentation/Plugins/Index.rst | 2 +- Resources/Private/Language/de.locallang.xlf | 12 ++-- .../Private/Language/de.locallang_be.xlf | 8 +-- Resources/Private/Language/locallang.xlf | 12 ++-- Resources/Private/Language/locallang_be.xlf | 12 ++-- .../{ValidationForm => Validation}/Main.html | 14 ++-- ...lidationform.svg => tx-dlf-validation.svg} | 2 +- .../Validation.js} | 2 +- ext_localconf.php | 8 +-- 16 files changed, 136 insertions(+), 77 deletions(-) rename Classes/Controller/{ValidationFormController.php => ValidationController.php} (63%) create mode 100644 Classes/Validation/Configuration/YamlConfigurationProvider.php rename Configuration/FlexForms/{ValidationForm.xml => Validation.xml} (88%) rename Resources/Private/Templates/{ValidationForm => Validation}/Main.html (79%) rename Resources/Public/Icons/{tx-dlf-validationform.svg => tx-dlf-validation.svg} (98%) rename Resources/Public/JavaScript/{ValidationForm/ValidationForm.js => Validation/Validation.js} (99%) diff --git a/Classes/Controller/ValidationFormController.php b/Classes/Controller/ValidationController.php similarity index 63% rename from Classes/Controller/ValidationFormController.php rename to Classes/Controller/ValidationController.php index a6cd1ab3d6..d2a35a8a38 100644 --- a/Classes/Controller/ValidationFormController.php +++ b/Classes/Controller/ValidationController.php @@ -12,18 +12,20 @@ namespace Kitodo\Dlf\Controller; +use Kitodo\Dlf\Validation\Configuration\YamlConfigurationProvider; use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Core\Site\Entity\SiteLanguage; +use TYPO3\CMS\Core\Utility\GeneralUtility; /** - * Plugin 'ValidationForm' for the 'dlf' extension + * Plugin 'Validation' for the 'dlf' extension * * @package TYPO3 * @subpackage dlf * * @access public */ -class ValidationFormController extends AbstractController +class ValidationController extends AbstractController { /** * @access public @@ -32,17 +34,16 @@ class ValidationFormController extends AbstractController */ public function mainAction(): ResponseInterface { + $validationConfiguration = GeneralUtility::makeInstance(YamlConfigurationProvider::class)->getConfiguration($this->settings['type']); + /** @var SiteLanguage $siteLanguage */ $siteLanguage = $this->request->getAttribute('language') ?? $this->request->getAttribute('site')->getDefaultLanguage(); $disabledValidators = []; - if (array_key_exists("domDocumentValidation", $this->settings)) { - $validationConfiguration = $this->settings['domDocumentValidation']; - foreach ($validationConfiguration as $key => $value) { - if (isset($value['disabled']) && $value['disabled'] === "true") { - $disabledValidators[$key]['title'] = $value['title']; - $disabledValidators[$key]['shortdescription'] = $value['shortdescription']; - } + foreach ($validationConfiguration as $key => $value) { + if (isset($value['disabled']) && $value['disabled'] === "true") { + $disabledValidators[$key]['title'] = $value['title']; + $disabledValidators[$key]['shortdescription'] = $value['shortdescription']; } } diff --git a/Classes/Middleware/DOMDocumentValidation.php b/Classes/Middleware/DOMDocumentValidation.php index dcdd0f6cc4..061bce02a9 100644 --- a/Classes/Middleware/DOMDocumentValidation.php +++ b/Classes/Middleware/DOMDocumentValidation.php @@ -15,6 +15,7 @@ use DOMDocument; use Exception; use InvalidArgumentException; +use Kitodo\Dlf\Validation\Configuration\YamlConfigurationProvider; use Kitodo\Dlf\Validation\DOMDocumentValidationStack; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; @@ -84,6 +85,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface if ($typeParam === null) { return $this->getJsonResponse('Validation type parameter is missing.', self::BAD_REQUEST); } + // load dom document from url if (!GeneralUtility::isValidUrl($urlParam)) { return $this->getJsonResponse('Parameter "' . $urlParam . '" is not a valid URL.', self::NOT_FOUND); @@ -104,26 +106,14 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface return $this->getJsonResponse("Content from the URL is not valid XML.", self::BAD_REQUEST); } - // retrieve validation configuration from plugin.tx_dlf typoscript - /** @var ConfigurationManagerInterface $configurationManager */ - $configurationManager = GeneralUtility::makeInstance(ConfigurationManagerInterface::class); - $typoScript = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); - - /** @var TypoScriptService $typoScriptService */ - $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class); - $settings = $typoScriptService->convertTypoScriptArrayToPlainArray($typoScript['plugin.']['tx_dlf.']['settings.']); - - if (!array_key_exists("domDocumentValidation", $settings)) { - $this->logger->error('DOMDocumentValidation is not configured.'); - return $this->getJsonResponse('An internal server error occurred.', self::INTERNAL_SERVER_ERROR); - } + $validationConfiguration = GeneralUtility::makeInstance(YamlConfigurationProvider::class)->getConfiguration($typeParam); - if (!array_key_exists($typeParam, $settings["domDocumentValidation"])) { + if (empty($validationConfiguration)) { $this->logger->debug('Validation configuration type in validationType parameter "' . $typeParam . '" does not exist.'); - return $this->getJsonResponse('Validation type does not exist.', self::NOT_FOUND); + return $this->getJsonResponse('Validation type parameter does not exist.', self::NOT_FOUND); } - $validationConfiguration = $this->removeDisabledValidators($parameters, $settings['domDocumentValidation'][$typeParam]); + $validationConfiguration = $this->removeDisabledValidators($parameters, $validationConfiguration); $validation = GeneralUtility::makeInstance(DOMDocumentValidationStack::class, $validationConfiguration); diff --git a/Classes/Validation/Configuration/YamlConfigurationProvider.php b/Classes/Validation/Configuration/YamlConfigurationProvider.php new file mode 100644 index 0000000000..0d05a5b05f --- /dev/null +++ b/Classes/Validation/Configuration/YamlConfigurationProvider.php @@ -0,0 +1,68 @@ +logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); + $this->packageManager = $packageManager ?? GeneralUtility::makeInstance(PackageManager::class); + $this->yamlFileLoader = $yamlFileLoader ?? GeneralUtility::makeInstance(YamlFileLoader::class); + } + + /** + * @return array> + */ + public function getConfiguration(string $type): array + { + foreach ($this->packageManager->getActivePackages() as $package) { + $packagePath = rtrim($package->getPackagePath(), '/'); + $configurationFile = $packagePath . '/Configuration/Kitodo/Validation/' . $type . '.yaml'; + if (is_file($configurationFile)) { + $configuration = $this->yamlFileLoader->load($configurationFile); + if (is_array($configuration)) { + return $configuration; + } else { + $this->logger->error('Invalid configuration file: ' . $configurationFile); + } + } + } + return []; + } +} diff --git a/Configuration/FlexForms/ValidationForm.xml b/Configuration/FlexForms/Validation.xml similarity index 88% rename from Configuration/FlexForms/ValidationForm.xml rename to Configuration/FlexForms/Validation.xml index 0ef5104ea7..8010534387 100644 --- a/Configuration/FlexForms/ValidationForm.xml +++ b/Configuration/FlexForms/Validation.xml @@ -20,8 +20,8 @@ 1 - - LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:validationForm.flexForm.type.description + + LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:validation.flexForm.type.description input required,trim diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index 2e6fb45f2c..265896dec9 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -101,22 +101,22 @@ $iconsDirectory . 'tx-dlf-embedded3dviewer.svg' ); -// Plugin "validationform". -$plugin = 'dlf_validationform'; +// Plugin "validation". +$plugin = 'dlf_validation'; $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$plugin] = $excludeList; $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$plugin] = $addList; \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( - 'dlf_validationform', - $flexFormsPathPrefix . 'ValidationForm.xml' + 'dlf_validation', + $flexFormsPathPrefix . 'Validation.xml' ); \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( 'Dlf', - 'ValidationForm', - $langFile . 'validationForm' . $title, - $iconsDirectory . 'tx-dlf-validationform.svg' + 'Validation', + $langFile . 'validation' . $title, + $iconsDirectory . 'tx-dlf-validation.svg' ); // Plugin "feeds". diff --git a/Configuration/TsConfig/ContentElements.tsconfig b/Configuration/TsConfig/ContentElements.tsconfig index a0545a667c..23dbef6646 100644 --- a/Configuration/TsConfig/ContentElements.tsconfig +++ b/Configuration/TsConfig/ContentElements.tsconfig @@ -146,13 +146,13 @@ mod.wizards.newContentElement.wizardItems { list_type = dlf_toolbox } } - tx_dlf_validationform { - iconIdentifier = tx-dlf-validationform - title = LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:validationForm.plugin.title - description = LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:validationForm.plugin.description + tx_dlf_validation { + iconIdentifier = tx-dlf-validation + title = LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:validation.plugin.title + description = LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:validation.plugin.description tt_content_defValues { CType = list - list_type = dlf_validationform + list_type = dlf_validation } } } diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index 24c86403e4..928984034f 100644 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -31,8 +31,8 @@ page { } includeJSFooter { - # ValidationForm plugin - kitodo-validationForm = EXT:dlf/Resources/Public/JavaScript/ValidationForm/ValidationForm.js + # Validation plugin + kitodo-validation = EXT:dlf/Resources/Public/JavaScript/Validation/Validation.js # Verovio plugin kitodo-verovio = EXT:dlf/Resources/Public/JavaScript/Verovio/verovio-toolkit-wasm.js diff --git a/Documentation/Plugins/Index.rst b/Documentation/Plugins/Index.rst index 79f8b07393..a769a5f6fd 100644 --- a/Documentation/Plugins/Index.rst +++ b/Documentation/Plugins/Index.rst @@ -1613,7 +1613,7 @@ Validation Form The plugin renders an input field where a METS URL can be entered. After submission, the document is loaded and validated against the :ref:`DOMDocumentValidation Middleware`. For the validation to work, a corresponding configuration (see :ref:`DOMDocumentValidation Middleware Configuration`) must be present in TypoScript, and the type of this configuration must be provided to the plugin as a required parameter. -:typoscript:`plugin.tx_dlf_validationform.` +:typoscript:`plugin.tx_dlf_validation.` .. t3-field-list-table:: :header-rows: 1 diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index dbb23049ea..273a0f5173 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -677,27 +677,27 @@ - + - + - + - + - + METS file here:]]> METS-Datei ein:]]> - + diff --git a/Resources/Private/Language/de.locallang_be.xlf b/Resources/Private/Language/de.locallang_be.xlf index 8fbe9a818a..afd0c1b51a 100644 --- a/Resources/Private/Language/de.locallang_be.xlf +++ b/Resources/Private/Language/de.locallang_be.xlf @@ -682,19 +682,19 @@ - + - + - + - + diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 03c8931243..48311c1566 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -506,22 +506,22 @@ - + - + - + - + - + METS file here:]]> - + diff --git a/Resources/Private/Language/locallang_be.xlf b/Resources/Private/Language/locallang_be.xlf index 3742ea885b..ec27263f9b 100644 --- a/Resources/Private/Language/locallang_be.xlf +++ b/Resources/Private/Language/locallang_be.xlf @@ -515,17 +515,17 @@ - + - + - - + + - - + + diff --git a/Resources/Private/Templates/ValidationForm/Main.html b/Resources/Private/Templates/Validation/Main.html similarity index 79% rename from Resources/Private/Templates/ValidationForm/Main.html rename to Resources/Private/Templates/Validation/Main.html index ad96909af2..9d44d5e06c 100644 --- a/Resources/Private/Templates/ValidationForm/Main.html +++ b/Resources/Private/Templates/Validation/Main.html @@ -15,16 +15,16 @@ {_all} -
+
@@ -35,7 +35,7 @@
- +
diff --git a/Resources/Public/Icons/tx-dlf-validationform.svg b/Resources/Public/Icons/tx-dlf-validation.svg similarity index 98% rename from Resources/Public/Icons/tx-dlf-validationform.svg rename to Resources/Public/Icons/tx-dlf-validation.svg index b2b86fd745..b9e1352cc0 100644 --- a/Resources/Public/Icons/tx-dlf-validationform.svg +++ b/Resources/Public/Icons/tx-dlf-validation.svg @@ -3,7 +3,7 @@ viewBox="0 0 16 16" version="1.1" id="svg3745" - sodipodi:docname="tx-dlf-validationform.svg" + sodipodi:docname="tx-dlf-validation.svg" inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" diff --git a/Resources/Public/JavaScript/ValidationForm/ValidationForm.js b/Resources/Public/JavaScript/Validation/Validation.js similarity index 99% rename from Resources/Public/JavaScript/ValidationForm/ValidationForm.js rename to Resources/Public/JavaScript/Validation/Validation.js index 9d05cdd691..3a1ed403ef 100644 --- a/Resources/Public/JavaScript/ValidationForm/ValidationForm.js +++ b/Resources/Public/JavaScript/Validation/Validation.js @@ -8,7 +8,7 @@ * LICENSE.txt file that was distributed with this source code. */ -const dlfValidationForms = document.querySelectorAll('.tx-dlf-validationform form'); +const dlfValidationForms = document.querySelectorAll('.tx-dlf-validation form'); /** * Get the data from an URL. diff --git a/ext_localconf.php b/ext_localconf.php index b3d8431f58..ffd69720a7 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -32,7 +32,7 @@ 'tx-dlf-statistics' => 'EXT:dlf/Resources/Public/Icons/tx-dlf-statistics.svg', 'tx-dlf-tableofcontents' => 'EXT:dlf/Resources/Public/Icons/tx-dlf-tableofcontents.svg', 'tx-dlf-toolbox' => 'EXT:dlf/Resources/Public/Icons/tx-dlf-toolbox.svg', - 'tx-dlf-validationform' => 'EXT:dlf/Resources/Public/Icons/tx-dlf-validationform.svg', + 'tx-dlf-validation' => 'EXT:dlf/Resources/Public/Icons/tx-dlf-validation.svg', ]; $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( \TYPO3\CMS\Core\Imaging\IconRegistry::class @@ -348,13 +348,13 @@ \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( 'Dlf', - 'ValidationForm', + 'Validation', [ - \Kitodo\Dlf\Controller\ValidationFormController::class => 'main', + \Kitodo\Dlf\Controller\ValidationController::class => 'main', ], // non-cacheable actions [ - \Kitodo\Dlf\Controller\ValidationFormController::class => '', + \Kitodo\Dlf\Controller\ValidationController::class => '', ] ); From 343c2c58cfdedb494e6defb09fdc8d9e162833e0 Mon Sep 17 00:00:00 2001 From: Beatrycze Volk Date: Mon, 19 Oct 2026 13:55:39 +0200 Subject: [PATCH 3/6] [MAINTENANCE] Remove unused INTERNAL_SERVER_ERROR constant --- Classes/Middleware/DOMDocumentValidation.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Classes/Middleware/DOMDocumentValidation.php b/Classes/Middleware/DOMDocumentValidation.php index 061bce02a9..4ae5d7de58 100644 --- a/Classes/Middleware/DOMDocumentValidation.php +++ b/Classes/Middleware/DOMDocumentValidation.php @@ -47,7 +47,6 @@ class DOMDocumentValidation implements MiddlewareInterface private const BAD_REQUEST = 400; private const NOT_FOUND = 404; - private const INTERNAL_SERVER_ERROR = 500; private ServerRequestInterface $request; From 6102627867be448d154250f830271f9948269a5d Mon Sep 17 00:00:00 2001 From: Beatrycze Volk Date: Mon, 19 Oct 2026 14:03:09 +0200 Subject: [PATCH 4/6] [MAINTENANCE] Add license header to YamlConfigurationProvider --- .../Configuration/YamlConfigurationProvider.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Classes/Validation/Configuration/YamlConfigurationProvider.php b/Classes/Validation/Configuration/YamlConfigurationProvider.php index 0d05a5b05f..1375598ce9 100644 --- a/Classes/Validation/Configuration/YamlConfigurationProvider.php +++ b/Classes/Validation/Configuration/YamlConfigurationProvider.php @@ -1,5 +1,15 @@ + * + * This file is part of the Kitodo and TYPO3 projects. + * + * @license GNU General Public License version 3 or later. + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + */ + namespace Kitodo\Dlf\Validation\Configuration; use TYPO3\CMS\Core\Configuration\Loader\YamlFileLoader; From 3b36634df5ee3b16992cb3e50756a9b7d4e4ae5d Mon Sep 17 00:00:00 2001 From: Beatrycze Volk Date: Mon, 19 Oct 2026 17:28:36 +0200 Subject: [PATCH 5/6] [MAINTENANCE] Standardize shortDescription array key name --- Classes/Controller/ValidationController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Controller/ValidationController.php b/Classes/Controller/ValidationController.php index d2a35a8a38..93975747be 100644 --- a/Classes/Controller/ValidationController.php +++ b/Classes/Controller/ValidationController.php @@ -43,7 +43,7 @@ public function mainAction(): ResponseInterface foreach ($validationConfiguration as $key => $value) { if (isset($value['disabled']) && $value['disabled'] === "true") { $disabledValidators[$key]['title'] = $value['title']; - $disabledValidators[$key]['shortdescription'] = $value['shortdescription']; + $disabledValidators[$key]['shortDescription'] = $value['shortDescription']; } } From 31ded264e331baaebdcab7ef6bc5a73d1cdbe2dc Mon Sep 17 00:00:00 2001 From: Beatrycze Volk Date: Wed, 21 Oct 2026 11:59:48 +0200 Subject: [PATCH 6/6] [DOCUMENATION] Update validation documentation for YAML configuration and plugin rename Reflects the migration of DOMDocumentValidation middleware configuration from TypoScript to YAML files and the renaming of the 'Validation Form' plugin to 'Validation'. This ensures the documentation accurately describes the current setup. --- Documentation/Developers/Validation.rst | 144 +++++++++++------------- Documentation/Plugins/Index.rst | 6 +- 2 files changed, 66 insertions(+), 84 deletions(-) diff --git a/Documentation/Developers/Validation.rst b/Documentation/Developers/Validation.rst index f6cd01849a..24224878a3 100644 --- a/Documentation/Developers/Validation.rst +++ b/Documentation/Developers/Validation.rst @@ -82,28 +82,7 @@ DOMDocumentValidation Middleware Configuration -------------------------- -The validation middleware can be configured through the plugin settings in TypoScript with the block called ``domDocumentValidation``. Under this block, configuration sections (referred to as type) for different validations can be defined. When directly referencing the middleware or using the :ref:`Plugin Validation Form`, this type must be provided as the ``validationType`` parameter. - - .. code-block:: - - plugin.tx_dlf { - settings { - domDocumentValidation { - typeA { - validator { - ... - }, - validatorStack { - ... - }, - ... - }, - typeB { - ... - }, - ... - - +The validation middleware can be configured via a YAML file located within any extending extension at the path ``EXT:/Configuration/Kitodo/Validation/``. The name of the configuration file must match the configured validation type, allowing you to define different validation rules. When directly referencing the middleware or using the :ref:`Plugin Validation`, this identifier must be provided as the ``validationType`` parameter. Validators derived from ``Kitodo\Dlf\Validation\AbstractDlfValidator`` can be configured here. This also includes the use of validation stack implementations derived from ``Kitodo\Dlf\Validation\AbstractDlfValidationStack``, which use ``DOMDocument`` as the ``valueClassName`` for validation. This allows for multiple levels of nesting. @@ -114,64 +93,67 @@ For each validator, the title and description can be defined as XLF labels and a The description label can include placeholders. The syntax changes slightly in this case: a separate block is used for the description, consisting of the XLF label as the key and an additional block containing arguments. These arguments are then inserted into the placeholders within the label in the given order. The ``EXT:`` prefix can also be used as an argument value, which will be replaced with the corresponding extension path. - .. code-block:: - - plugin.tx_dlf { - settings { - domDocumentValidation { - typeA { - 10 { - title = LLL:EXT:.../locallang.xlf:title - description = LLL:EXT:.../locallang.xlf:description - } - ... - }, - typeB { - 10 { - title = LLL:EXT:.../locallang.xlf:title - description { - key = LLL:EXT:.../locallang.xlf:description - arguments { - 0 = EXT:... - 1 = Test - ... - } - } - ... - -TypoScript Example + .. code-block:: yaml + + 1: + title: 'LLL:EXT:.../locallang.xlf:title' + shortDescription: 'LLL:EXT:.../locallang.xlf:description' + description: 'LLL:EXT:.../locallang.xlf:description' + 2: + title: 'LLL:EXT:.../locallang.xlf:title' + description: + key: 'LLL:EXT:.../locallang.xlf:description' + arguments: + 0: 'EXT:...' + 1: 'Test' + className: '...\ApplicationProfileValidationStack' + +YAML Example ^^^^^^^^^^^^^^^^^^^^^^^^^ - .. code-block:: - - plugin.tx_dlf { - settings { - storagePid = {$config.storagePid} - domDocumentValidation { - dfgviewer { - 10 { - title = LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.xmlschemas.title - description { - key = LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.xmlschemas.description - arguments { - 0 = EXT:dfgviewer/Resources/Public/Xsd/Mets/1.12.1.xsd - 1 = METS 1.12.1 - 2 = EXT:dfgviewer/Resources/Public/Xsd/Mods/3.8.xsd - 3 = MODS 3.8 - } - } - className = Kitodo\Dlf\Validation\XmlSchemasValidator - configuration { - mets { - namespace = http://www.loc.gov/METS/ - schemaLocation = EXT:dfgviewer/Resources/Public/Xsd/Mets/1.12.1.xsd - } - mods { - namespace = http://www.loc.gov/mods/v3 - schemaLocation = EXT:dfgviewer/Resources/Public/Xsd/Mods/3.8.xsd - } - } - }, - ... - } - ... + .. code-block:: yaml + + 1: + title: 'LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.xmlschemas.title' + shortDescription: 'LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.xmlschemas.shortdescription' + description: + key: 'LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.xmlschemas.description' + arguments: + 0: 'EXT:dfgviewer/Resources/Public/Xsd/Mets/1.12.1.xsd' + 1: 'METS 1.12.1' + 2: 'EXT:dfgviewer/Resources/Public/Xsd/Mods/3.8.xsd' + 3: 'MODS 3.8' + className: 'Kitodo\Dlf\Validation\XmlSchemasValidator' + configuration: + mets: + namespace: 'http://www.loc.gov/METS/' + schemaLocation: 'EXT:dfgviewer/Resources/Public/Xsd/Mets/1.12.1.xsd' + mods: + namespace: 'http://www.loc.gov/mods/v3' + schemaLocation: 'EXT:dfgviewer/Resources/Public/Xsd/Mods/3.8.xsd' + 2: + title: 'LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.metsapplicationprofile.title' + shortDescription: 'LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.metsapplicationprofile.shortdescription' + description: + key: 'LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.metsapplicationprofile.description' + arguments: + 0: '/fileadmin/groups/dfgviewer/METS_application_profile_2.4.pdf' + 1: 'METS Application Profile version 2.4' + className: 'Slub\Dfgviewer\Validation\Mets\ApplicationProfileValidationStack' + 3: + title: 'LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.modsapplicationprofile.title' + shortDescription: 'LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.modsapplicationprofile.shortdescription' + description: + key: 'LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.modsapplicationprofile.description' + arguments: + 0: '/fileadmin/groups/dfgviewer/MODS_application_profile_2.4.pdf' + 1: 'MODS Application Profile version 2.4' + className: 'Slub\Dfgviewer\Validation\Mods\ApplicationProfileValidationStack' + 4: + title: 'LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.metsurlexistence.title' + shortDescription: 'LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.metsurlexistence.shortdescription' + description: 'LLL:EXT:dfgviewer/Resources/Private/Language/locallang_validation.xlf:validator.metsurlexistence.description' + className: 'Slub\Dfgviewer\Validation\MetsUrlExistenceValidator' + configuration: + excludeHosts: 'dfg-viewer.de,www.loc.gov,id.loc.gov,www.openarchives.org,purl.org,www.w3.org' + disabled: true diff --git a/Documentation/Plugins/Index.rst b/Documentation/Plugins/Index.rst index a769a5f6fd..ce6833848d 100644 --- a/Documentation/Plugins/Index.rst +++ b/Documentation/Plugins/Index.rst @@ -1606,12 +1606,12 @@ The model URL is extracted from the METS file or taken from the provided model p } } -.. _Plugin Validation Form: +.. _Plugin Validation: -Validation Form +Validation --------------- -The plugin renders an input field where a METS URL can be entered. After submission, the document is loaded and validated against the :ref:`DOMDocumentValidation Middleware`. For the validation to work, a corresponding configuration (see :ref:`DOMDocumentValidation Middleware Configuration`) must be present in TypoScript, and the type of this configuration must be provided to the plugin as a required parameter. +The plugin renders an input field where a METS URL can be entered. After submission, the document is loaded and validated against the :ref:`DOMDocumentValidation Middleware`. For the validation to work, a corresponding configuration (see :ref:`DOMDocumentValidation Middleware Configuration`) must be present in your extension, and the type of this configuration must be provided to the plugin as a required parameter. :typoscript:`plugin.tx_dlf_validation.`