Releases: elgentos/magento2-prismicio
Fixed the category helper
- Added an extend
- Fixed a typo in the file name
Created support for meta robots block
1.11.1 Robots meta data block
Added a helper to get the category id automatically
What's Changed
- Introduces a method getUid() that returns the category ID prefixed with 'category-' or an empty string if no current category can be found in the layer resolver (which I assume to be some kind of registry) #82
Full Changelog: 1.10.0...1.11.0
Image Block refactor (breaking change)
This release contains a breaking change to the Image block. Prior to this release you needed to give the block the plain url for the image.
In this new release you can reference the image object. So the width, height and alt are set correctly on the image tag.
How to fix this breaking change in the code base:
- search for all uses of this block:
Elgentos\PrismicIO\Block\Dom\Image"
- Change the .url to nothing like in the example below:
<block class="Elgentos\PrismicIO\Block\Dom\Image" template="data.product.data.product_img.url" />
<block class="Elgentos\PrismicIO\Block\Dom\Image" template="data.product.data.product_img" />
Also you can set classes with the css_classes data in this block like this:
<arguments>
<argument name="css_class" xsi:type="string">product</argument>
</arguments>
Update image.php
Merge pull request #81 from elgentos/WouterSteen-patch-2 image block update 1.7 release line
Fixed redirect bug for pages that dont exist within prsmic
Merge pull request #78 from elgentos/WouterSteen-patch-1 Redirect page to new uid
Fixed redirect url
Merge pull request #79 from elgentos/WouterSteen-patch-2 Redirect to right url for 1.7 release line
1.9.2
Added a html serializer as suggested in #71
thank @speedupmate for rethinking and simplifying this...
Create the next class and use it in your layour.xml.
use Magento\Framework\View\Element\Block\ArgumentInterface;
use Prismic\Fragment\BlockInterface;
class Something implements ArgumentInterface
{
public function __invoke(BlockInterface $block, string $content)
{
// do what you want
}
}
Fixed compatibility with Prismicsdk closure requirement
This will fix #71 thanks @speedupmate
To use a custom serializer in Magento you can create a plugin on \Elgentos\PrismicIO\ViewModel\HtmlSerializer::serialize
A afterSerialize
would get string $result = null, \Prismic\Fragment\BlockInterface $object, string $content
function afterSerialize (null $result, \Prismic\Fragment\BlockInterface $object, string $content)
{
if ($object->type === 'heading1') {
return '<h1 class="awesome">' . $content . '</h1>';
}
return $result;
}
If a custom serializer does not return null
that result will be returned, else the default serializer of Prismic will render the content