WHAT YOU'LL LEARN
  • How to create content models using the Model Builder?

Overview
anchor

The Model Builder allows you to programmatically create content models. Instead of manually creating models through the Admin UI, you can define them in code, which is ideal for version control, automated deployments, and creating reusable model templates.

By implementing the ModelFactory interface, you can define complete content models with their fields, layouts, API names, and relationships. The builder provides a fluent API that makes it easy to configure various field types (text, rich text, file, reference, etc…) and their properties. Models can be organized into groups and can reference other models to create complex content structures.

This approach is particularly useful when you need to provision models as part of a plugin, extension, or during project setup, ensuring consistency across different tenants and environments.

Code Example
anchor