Blocks with no model not creatable

Vote:
 

Hi,

For a client's project we need to create block types at runtime. This means that we create the block type without a backing model (class). The creation goes well and the block type is visible as a content type in the admin interface. However, the new block type is not available when trying to create an instance of it from the edit interface. I click the "+" icon in the assets pane, but the created block type is not in the list of available types.

Grateful for some insight.

#216529
Feb 07, 2020 16:16
Vote:
 

Emil, it might help a bit if you could tell us more about this requirement - what is it that you are "actually" trying to achieve?

Based on your current description you want to create a block type "definition" but there is no backing model for it? Did a quick test and if I don't set the "BlockType" ModelType property to at least to typeof(BlockData) then that type is yes visible in admin but you can't create it in edit mode.

#216933
Feb 11, 2020 9:49
Vote:
 

Hi Emil!

Did you verify that you set AvailableInEditMode to true? This is set to true by default when decorating a backing model with the ContentTypeAttribute.

#216946
Feb 11, 2020 12:46
- Feb 11, 2020 12:53
If talking about the ContentType or BlockType types, the IsAvailable property is true by default.
Mattias Olsson - Feb 11, 2020 12:59
Yes, I noticed that. Could it be something with AvailableSetting for the block type?
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.