Skip to content

Custom Types for Custom Fields - Answers needed! #1458

Answered by michaelbromley
eddast asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Edda,
So I can think of a couple of ways to implement this:

  1. Create a new Entity representing, e.g. InfoTab. Then use a custom field with type 'relation' and list: true as covered here: https://www.vendure.io/docs/developer-guide/customizing-models/#relations. This is the more complex option and might be overkill.
  2. Use a text field and store a JSON stringified object with eg label and content properties.

In both cases, you'll need to implement a custom UI form input component to manipulate these values. E.g. in option 2, the component would do JSON.parse() on the stored value, and upon saving would do JSON.stringify().

Personally I would probably prefer option 2 because it is much simp…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@eddast
Comment options

Answer selected by eddast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants