ContentArea property has builtin functionality of limiting content types that could be used in the editor. It’s implemented with AllowedTypes attribute. The attribute should be placed on the model and list all of available types.

Standard ContentArea

In the same way, AllowedTypes attribute could be used together with Content References List property. The difference is that Content References property editor shows defined types and the editor can see which types could be used on the list and which not.

Content References list with allowed types

In my current project we have a lot of block types and page types.  I tried to add Allowed Types list preview to Edit Mode to be similar to Content Reference property. New property will extended ContentAreaEditor client editor and add Allowed Types toolbar. The toolbar will be reused from Content References client editor code (epi-cms/contentediting/editors/ContentReferenceListEditor).

The list will be automatically populated inside “epi-cms/contentediting/AllowedTypesList” widget. The widget markup is returned by getAllowedTypesTemplate method (it could be a separated HTML template, but I decided to keep everything in one file). I also need to move “epi-content-area-editor” CSS class inside the editor.

To use new property we need to set ClientEditor attribute on model property. We will only change the widget editor class, system will still use ContetAreaEditorDescriptor. It means that all necessary editor configuration will be applied.

After running the application, list of all available types will appear in the edit mode.

ContentArea allowed types