Add a "code only" inline static block to ContentArea before rendering

Vote:
 

Hi

I have a ContentArea property that may or may not be null/empty, but should always show at least one static block (preferably "code only").

I'm rendering the ContentArea from the view model rather than the page when not in editing, to be able to create/modify it before rendering.

If a ContentArea exists on the page property, it is copied to the view model, else I create a new on the view model.
I then go on and create the block in code and add it to the ContentArea.

I have tried both creating a new block "in code" (as inline block) as well as a saved block (from a settings page).

But I do not get it to render anything.

When I debug, the block appears in the filtered items list, but it never seem to gets to rendering it.

Is this at all possible? Or am I missing something?

Thanks!

#328760
Edited, Sep 04, 2024 7:29
ZZ
Vote:
 

Hi,

If possible please share code. Where do have placed your block view file ?

#330166
Sep 18, 2024 10:27
* 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.