As the title says: I've got a custom input filter in Drupal 7 which replaces a token with a custom drupal form. Without showing the complete code, which might just confuse things, The main essence is the following:
function _my_filter($text, $filter = NULL, $format = NULL, $langcode = NULL, $cache = NULL, $cache_id = NULL) {
$rendered_text = $text;
preg_match_all(MY_CUSTOM_REGEX, $text, $matches);
if (!empty($matches[0])) {
foreach ($matches[0] as $match) {
$custom_form = drupal_get_form('my_custom_form');
$replacement = drupal_render($custom_form);
$rendered_text = str_replace($match, $replacement, $rendered_text);
}
}
return $rendered_text;
}
For some reason when the node is being saved this times out. I've narrowed it down to being something in my drupal_get_form (but this form renders fine without any problems outside of an input filter).
Can I use drupal_get_form and drupal_render within an input filter like this?