Jump to content

Recommended Posts

Posted

I am using invision blocks in my application. The block A contains a HTML editor which you can use to insert HTML by our content writers

My current project require you to insert another block B inside this HTML editor

 

Inserting 

{block="Block_B"}

in the HTML of block A didn't work. How do I make IPS process the block B inside block A. Note: I wrote both the Block A and Block B, and use the default HTML editor from IPS.
Posted

That isn’t possible. Template tags like {block="block_id"} are only rendered in templates, not in an editor context. 

If the blocks are set up as HTML (not Editor) you can however call blocks from within blocks from within blocks …

Posted

I ended up writing a small patch which implemented this functionality.

 

$configuration[$contentField] = preg_replace_callback('~\{block=([\'"])(.*?)\1\}~', function ($match) {
    $blockKey = $match[2];
    $block = Block::load($blockKey, 'block_key');
    return $block->widget()->render();
}, $configuration[$contentField]);
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...