Create a package which contains 3 files:

  1. Model class (MyContentBlock.java)
  2. Edit form (myContentBlockEdit.scala.html)
  3. Frontent view template (myContentBlockShow.scala.html)

Then you register your new block with the cms and restart play and you're done.

Create the model

Create a class that extends from the chosen archetype:

  • PageBlock for pages or navigation entries
  • CollectionBlock for collections of content blocks that can be added e.g. to page columns
  • ContentBlock for any movable block that contains content

Example, MyContentBlock.java:

package blocks.mycontentblock;
import ch.insign.cms.models.BlockFinder;
import ch.insign.cms.models.ContentBlock;
@Table(name = "my_content_block")
public class MyContentBlock extends ContentBlock {
    public static BlockFinder<MyContentBlock> find = new BlockFinder<>(MyContentBlock.class);
    @OneToOne (cascade=CascadeType.ALL)
    private MString subtitle = new MString();
    public MString getSubtitle() {
        return this.subtitle;
    public void setSubtitle(MString subtitle) {
        this.subtitle = subtitle;
    public Html render() {
        return blocks.mycontentblock.html.show.render(this);
    public Html editForm(Form editForm) {      
        String backURL = Controller.request().getQueryString("backURL");     
        return blocks.mycontentblock.html.edit.render(this, editForm, backURL, null);


  • Block classes inherit from Model and thus are JPA entity classes
  • Add multi-language properties using MString as seen in the example
  • render() Returns the block's rendered frontend view
  • editForm() returns the rendered edit form for this block
  • @Table and @DiscriminatorValue must be unique in your project.
  • How to access subclass getters from navigation

Create the edit form

You can either choose to use the default edit form base and place your content elements inside.

Example, edit.scala.html:

@(data: blocks.mycontentblock.MyContentBlock, editForm: Form[_], backURL: String)(extension: Html=Html.apply(""))
@import ch.insign.cms.views.html.admin._
@contentBlockEdit(data, editForm, backURL){
        theForm = editForm,
        formKey = "subtitle",
        label = "Subtitle",
        placeholder = ""

The base edit template currently includes:

  • language tabs (for MString properties)
  • Virtual path and visibility control (for PageBlock subclasses)
  • Time- and role-based access management

Tip: add @extension to allow later subclasses to add their content.

Alternatively, you can create your own template. 

Create the frontend template

This is straight-forward. Example:


@(data: blocks.mycontentblock.MyContentBlock)
@import ch.insign.cms.views.html._
@import ch.insign.cms.models.Template
@_blockBase(data = data, delete=true, edit=true, add=false, color="red", name="MyContentBlock") {


  • Use @_blockBase() to import the default cms frontend edit controls. They're only visible for logged in users with write access to the particular block.
  • Edit buttons can be controlled as seen
  • Color and name are used for the debug mode (&debug=true)

Register your new block

In your CMSApiLifecycle implementation class, add the new block to registerCmsBlocks():


public class MyCMSApiLifecycle extends CMSApiLifecycleImpl {
// ...
    protected void registerCmsBlocks(CMSApi cmsApi) {


Congratulations, your new ContentBlock is ready and can be added to pages and collections.

Note: When adding blocks to the play-cms itself, an entry in play-cms-orm.xml is also required.