Custom editables and validation

a) I already found the list of editables at https://pimcore.com/docs/5.x/Development_Documentation/Documents/Editables/index.html but I could not find a tutorial or at least an example of how to develop my own editables. Does any one have a good resource which I could study?

b) Concerning the already defined editables I wonder if some validation can be added. For example it would be really nice if I could limit an editable of type Input to only accept phone numbers or ISBN numbers. Would be awesome if regex could be used for this task.

c) Is it possible to include bricks inside bricks?

I’m happy for any suggestions/comments!

Have a look at the possibilities you have in the data objects :slight_smile:

Document editables are meant for “basic” use cases. In case of validation, etc. you probably wanna use a data object instead. Recently, mandatory fields were introduced for editables. Which kind of editable are you missing / would you like to create?

Thank you for your response @ckemptner!
Examples of editables I’ll need for a simple project are

  1. Input field with validation for product references, regex would be like “/(US|DE)-\d{2}-\d{2}-[d{6}/”
  2. Google map where editor can choose coordinate of shop location. Probably consisting of a map and 2 inputs for longitude/latitude, fed by manual input or coordinates picked on map.

After your feedback I wonder if using editables is the way to go. Looks like I have to consider using data objects. Documentation on the topic seems sparse, can you recommend some useful resources for self studies, may be even including some samples?

For both of these, data objects are easier to use if you want to ensure the UX is good. Data objects have a predefined map coordinate datatype already that fills your requirements, also it’s possible to add regexes to text fields for validation.

1 Like