<noscript data-src-small="small.jpg" data-src-large="large.jpg" data-width="300" data-height="200"> <img src="small.jpg" width="300" height="200"> </noscript>
So I wrote a custom ViewHelper (or rather I copied and modified an existing one) that does exactly this and it works, but I'm not sure I'm doing it right, because I'm manually creating the
<img> like this:
$content = '<img class="'.$class.'" alt=" " src="'.$imageSource.'" width="'.$imageInfo.'" height="'.$imageInfo.'">'; $this->tag->setContent($content);
I wonder if there isn't a better way to do this, ideally I'd like to call the standard
ImageViewHelper::render() function inside my custom ViewHelper.
Is there any way to do that? Should that even be done at all?
I am aware, I could adjust my template like this:
<x:noscript src="filename.jpg" width="300"> <f:image src="filename.jpg" width="300" /> </x:noscript>
x:noscriptis supposed to be my custom ViewHelper)
renderChildren() inside my ViewHelper.
But then I would have to repeat
src="filename.jpg" width="300" and I generally don't like to repeat input if there's a better way.