Jump to content

How do I embed block inside a block HTML editor

Recommended Posts

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




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.
Link to comment
Share on other sites

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]);
Link to comment
Share on other sites

  • Recently Browsing   0 members

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