VarunAgw Posted July 15, 2021 Share Posted July 15, 2021 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. Link to comment Share on other sites More sharing options...
opentype Posted July 15, 2021 Share Posted July 15, 2021 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 … Link to comment Share on other sites More sharing options...
VarunAgw Posted July 17, 2021 Author Share Posted July 17, 2021 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 More sharing options...
Recommended Posts