Skip to content

FEATURE: Add notEmpty validation for asset metadata fields and improve UI feedback#20

Merged
mficzel merged 8 commits intomainfrom
FEATURE/addValidation
Jan 28, 2026
Merged

FEATURE: Add notEmpty validation for asset metadata fields and improve UI feedback#20
mficzel merged 8 commits intomainfrom
FEATURE/addValidation

Conversation

@Alvadda
Copy link
Collaborator

@Alvadda Alvadda commented Dec 18, 2025

This PR adds validation for the title and alt fields per image in both the single editor and the collection editor.

To enable validation, add a validation configuration with the notEmpty rule and specify the fields to validate (e.g. alt, title). This ensures that the UI correctly reflects the validation state for users in both editor variants.

To prevent users from applying an invalid configuration, a corresponding server-side validator must also be provided. The validator
Sitegeist.Kaleidoscope.ValueObjects/Validators/NotEmpty mirrors the structure of the validation configuration defined in editorOptions, ensuring consistent validation behavior between the UI and backend.

    image:
      ui:
        inspector:
          editorOptions:
            crop:
              aspectRatio:
                forceCrop: true
                locked:
                  width: 4
                  height: 3
            validation:
              notEmpty:
                alt: true
                title: true
      validation:
        'Sitegeist.Kaleidoscope.ValueObjects/Validators/NotEmpty':
          alt: true
          title: true
image image

@mficzel
Copy link
Member

mficzel commented Jan 5, 2026

I ran straight into this when creating a new content with enabled validation:

Name: TypeError

Message: Cannot read properties of null (reading 'alt')

Stacktrace: TypeError: Cannot read properties of null (reading 'alt')
    at isValueValid (https://site-de.ddev.site/_Resources/Static/Packages/Sitegeist.Kaleidoscope.ValueObjects/JavaScript/Plugin.js?bust=d2948a2f:6010:62)
    at NotEmpty (https://site-de.ddev.site/_Resources/Static/Packages/Sitegeist.Kaleidoscope.ValueObjects/JavaScript/Plugin.js?bust=d2948a2f:6029:10)
    at n (https://site-de.ddev.site/_Resources/Static/Packages/Neos.Neos.Ui.Compiled/Build/Host.js?bust=baef9f8c:15:102013)
    at https://site-de.ddev.site/_Resources/Static/Packages/Neos.Neos.Ui.Compiled/Build/Host.js?bust=baef9f8c:15:102151
    at Array.map (<anonymous>)
    at Gee (https://site-de.ddev.site/_Resources/Static/Packages/Neos.Neos.Ui.Compiled/Build/Host.js?bust=baef9f8c:15:102125)
    at https://site-de.ddev.site/_Resources/Static/Packages/Neos.Neos.Ui.Compiled/Build/Host.js?bust=baef9f8c:15:102312
    at Array.forEach (<anonymous>)
    at REt (https://site-de.ddev.site/_Resources/Static/Packages/Neos.Neos.Ui.Compiled/Build/Host.js?bust=baef9f8c:15:102265)
    at https://site-de.ddev.site/_Resources/Static/Packages/Neos.Neos.Ui.Compiled/Build/Host.js?bust=baef9f8c:15:103396

to reproduce: create content that has an image with enabled validation, select content that has no image selected yet

@mficzel
Copy link
Member

mficzel commented Jan 13, 2026

Works fine now in general. I suggest to

  1. Remove the mentioning of "Sitegeist.Kaleidoscope.ValueObjects/Validators/NotEmpty" that is not implemented and also does not work properly anyways. The feature here is merely editor support and does not gain much by additional serverside validation
  2. Translate the Error message at least into de / en / fr (add Xliff files in Resources/Private/Translations + Setting Neos.Neos.userInterface.translation.autoInclude.Sitegeist.Kaleidoscope.ValueObjects)
  3. When the be validation is not configured the error message is not shown but the value can be applied ... this may be intentional and also solve the translation issue before as it merly hints and not enforces hard

@Alvadda
Copy link
Collaborator Author

Alvadda commented Jan 16, 2026

Works fine now in general. I suggest to

  1. Remove the mentioning of "Sitegeist.Kaleidoscope.ValueObjects/Validators/NotEmpty" that is not implemented and also does not work properly anyways. The feature here is merely editor support and does not gain much by additional serverside validation
  2. Translate the Error message at least into de / en / fr (add Xliff files in Resources/Private/Translations + Setting Neos.Neos.userInterface.translation.autoInclude.Sitegeist.Kaleidoscope.ValueObjects)
  3. When the be validation is not configured the error message is not shown but the value can be applied ... this may be intentional and also solve the translation issue before as it merly hints and not enforces hard

Added Translations to the Package

Translation Package name: Sitegeist.Kaleidoscope.ValueObjects
Translation key for Validation: validation

New Translations:

validation.missingAlt
validation.missingTitle
validation.missingTitleAndAlt
validation.collectionItemMissingAlt
validation.collectionItemMissingTitle
validation.collectionItemMissingTitleAndAlt

@mficzel mficzel force-pushed the FEATURE/addValidation branch from a455820 to 1d712cd Compare January 28, 2026 09:42
@mficzel mficzel merged commit 527e1b4 into main Jan 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants