We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6cb6896 + 304a2ae commit a18cea6Copy full SHA for a18cea6
Block/Dom/Image.php
@@ -2,10 +2,23 @@
2
3
namespace Elgentos\PrismicIO\Block\Dom;
4
5
-class Image extends Raw
+use Elgentos\PrismicIO\Block\AbstractBlock;
6
+
7
+class Image extends AbstractBlock
8
{
9
public function fetchDocumentView(): string
10
- return '<img src="' . $this->escapeHtml(parent::fetchDocumentView()) . '" alt="' . $this->getAltText() . '" />';
11
+ $context = $this->getContext();
12
13
+ $cssClasses = $this->getData('css_class') ? 'class="'. $this->getData('css_class') .'"' : '';
14
15
+ return sprintf(
16
+ '<img src="%s" alt="%s" width="%d" height="%d" %s />',
17
+ $context->url,
18
+ $context->alt,
19
+ $context->dimensions->width,
20
+ $context->dimensions->height,
21
+ $cssClasses
22
+ );
23
}
24
0 commit comments