Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted July 15, 20213 yr 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.
July 15, 20213 yr 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 …
July 17, 20213 yr Author 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]);