I have a custom input filter module, and I am trying to figure out why it crashes when I attempt to insert a block into a post via a shortcode. The method works perfectly when I am inserting a string, but when I try to insert a block, it causes a http 500 error.
Any ideas? I am using Drupal 7.15. Also, I have tried the insert_block module, and it generates a similar error…
Here is the input filter process that works (with a string)
function _related_links_filter_related_block_process($text, $filter, $format) { $shortcode_regexp = "/[block]/"; $output = "Text string inserted in via shortcode"; return preg_replace($shortcode_regexp, $output,$text); }
Here is the input filter process that causes the error (with a block)
function _related_links_filter_related_block_process($text, $filter, $format) { $shortcode_regexp = "/[block]/"; $block = block_load('block', 3); $output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block)))); return preg_replace($shortcode_regexp, $output,$text); }
Any help is appreciated!