Skip to content

Commit

Permalink
Prismic\RichText::asHtml expects a closure
Browse files Browse the repository at this point in the history
+ added closure as quick fix, will make htmlserializer invokable as
  second update
  • Loading branch information
JeroenBoersma committed Jul 15, 2022
1 parent c494c01 commit 9e81a94
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Block/Dom/RichText.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function fetchDocumentView(): string
$html = PrismicRichText::asHtml(
$this->getContext(),
$this->getLinkResolver(),
[$this->htmlSerializer, 'serialize']
fn($object, string $content) => $this->htmlSerializer->serialize($object, $content)
);

return $this->replaceRelativeUrl($html);
Expand Down
5 changes: 3 additions & 2 deletions ViewModel/HtmlSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@


use Magento\Framework\View\Element\Block\ArgumentInterface;
use Prismic\Fragment\BlockInterface;

class HtmlSerializer implements ArgumentInterface
{

/**
* Html Serializer is sent to rich text parser
*
* @param \stdClass $object
* @param BlockInterface $object
* @param string $content
* @return string|null
*/
public function serialize(\stdClass $object, string $content): ?string
public function serialize(BlockInterface $object, string $content): ?string
{
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"minimum-stability": "stable",
"require": {
"php": ">=8.1",
"elgentos/prismic-php-sdk": "^6.0",
"elgentos/prismic-php-sdk": "^6.1",
"magento/framework": "*"
},
"replace": {
Expand Down

0 comments on commit 9e81a94

Please sign in to comment.