Source of file ResponsiveWYSIWYGImages.php
Size: 1,142 Bytes - Last Modified: 2021-12-23T10:20:22+00:00
/var/www/docs.ssmods.com/process/src/code/ResponsiveWYSIWYGImages.php
123456789101112131415161718192021222324252627282930313233343536373839 | <?php /** * ResponisveWYSIWYGImages * * @package silverstripe-responsive-wysiwyg-image * @author shea@livesource.co.nz **/ class ResponisveWYSIWYGImages extends Object { /** * Replace "[responsiveimage]" shortcode with responsive image markup * @param $arguments array Arguments to the shortcode * @param $content string Content of the returned link (optional) * @param $parser object Specify a parser to parse the content (see {@link ShortCodeParser}) * @return string rendered HTML template */ public static function shortcode_handler($arguments, $content = null, $parser = null) { $setName = isset($arguments['responsiveset']) ? $arguments['responsiveset'] : null; $id = isset($arguments['id']) ? $arguments['id'] : null; if (!$setName || !$id) { return; } $image = Image::get()->byID($id); $sets = Config::inst()->get('ResponsiveImageExtension', 'sets'); if (!$image || !isset($sets[$setName])) { return; } $set = $sets[$setName]; return $image->$setName()->forTemplate(); } } |