Feb 2nd, 2013
A friend was working on image handling with the media module and found that it was next to impossible to remove a <p> tag wrapper. Here's some quick code which creates a text filter to remove that wrapper.
<?php /** * Implements hook_filter_info(). */ function mymodule_filter_info() { $filters = array(); $filters['mysite_inline_image_cleanup'] = array( 'title' => t('My Site Inline Image Cleanup'), 'description' => t('Removes the wrapping paragraph tags from an inline image element'), 'process callback' => '_mymodule_iic_process', ); return $filters; } function _mymodule_iic_process($text, $filter, $format, $langcode, $cache, $cache_id) { $replace = preg_replace("/\<p\>(\[\[.*?\]\])\<\/p\>/s", "$1", $text); return $replace; } ?>