Pimcore Mandatory Metadata

508 views Asked by At

is there an option to set some metadata from assets as a mandatory field ?

For data-objects you can create mandatory fields, but I need this option for the metadata of the asstes.

1

There are 1 answers

0
Igor Benko On BEST ANSWER

There is no such built-in option. But you can validate the data either in the frontend or the backend and disallow saving if not all required metadata is filled in.


Backend validation

You could for example throw a new Exception in a pre-update event listener:

throw new \Pimcore\Model\Element\ValidationException("This is your custom error message", 1234);

List of all Asset Events


You could also check the data in the frontend as described here:

Frontend validation