public function filter($content, array $options = array()) { if ($this->blockProperty->getMetadata()->offsetExists('image')) { $element = $this->blockProperty->getMetadata()->get('image')->getReferencedElement(); if ($element !== null) { /* @var $element ImageReferencedElement */ if (!$element instanceof ImageReferencedElement) { // @TODO: any exception should be thrown probably return null; } $imageId = $element->getImageId(); $fileStorage = $this->container['cms.file_storage']; /* @var $fileStorage \Supra\Package\Cms\FileStorage\FileStorage */ $image = $fileStorage->findImage($imageId); if ($image) { $tag = new ImageTag($image, $fileStorage); $tag->setAttribute('alt', $element->getAlternateText()); return $tag; } } } return null; }