bernhard Posted May 12, 2015 Share Posted May 12, 2015 very simple module to turn this: into this: <?php /** * ProcessWire Yumpu Replace Textformatter * * @copyright Copyright (c) 2015, Bernhard Baumrock, dimacon.at */ class TextformatterYumpu extends Textformatter { public static function getModuleInfo() { return array( 'title' => 'Yumpu replace', 'version' => 1, 'summary' => 'Replaces Yumpu Links with responsive Iframes', 'author' => 'Bernhard Baumrock, dimacon.at', ); } /** * Format the input string * * @param string $str The block of text to parse * * The incoming string is replaced with the formatted version of itself. **/ public function format(&$str) { // convert yumpu links to iframes $str = preg_replace("/https:\/\/www.yumpu.com\/(..\/)?embed\/view\/\w*/", '<div class="TextformatterVideoEmbed" style="position:relative;padding:30px 0 56.25% 0;height:0;overflow:hidden;"><iframe style="position:absolute;top:0;left:0;width:100%;height:100%;" width="640" height="360" src="\0" frameborder="0" allowfullscreen></iframe></div>', $str); } } I think there are also other solutions but maybe this one fits better for someone... 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now