Expand my Community achievements bar.

SOLVED

How to create a content fragment model in code?

Avatar

Level 9

There are tutorials showing how to create a content fragment model via the web UI. This is of little use, as this will exist only on a developers local instance.

 

We need a way to create content fragment models in our projects repository, so that we can build and deploy it to all our environments, and so that other developers get the model when they checkout the code from git and build / install?

 

We have the same issue with page template types.

 

Any ideas?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

The content fragment models / Templates can be made part of ui.content module to be deployed on all servers.

 

  1. Create a CFM using Web UI
  2. Package the CFM and download
  3. Add the CFM to ui.content module of the project. Update filter.xml (preferably set the mode to update)
  4. Deploy code

Once deployed, you would be able to access the CFM on server or other developer's system


Aanchal Sikka

View solution in original post

3 Replies

Avatar

Employee

Hi,

 

I'm part of the product team.

We have a new API for managing Content Fragment models about to be released.

 

There's a JSON payload to provide as request body.

How do you store those models today?

 

Regards,

Gilles

Avatar

Correct answer by
Community Advisor

The content fragment models / Templates can be made part of ui.content module to be deployed on all servers.

 

  1. Create a CFM using Web UI
  2. Package the CFM and download
  3. Add the CFM to ui.content module of the project. Update filter.xml (preferably set the mode to update)
  4. Deploy code

Once deployed, you would be able to access the CFM on server or other developer's system


Aanchal Sikka