Migration guide - CmsBlockWidget
Edit on GitHubUpgrading from version 1.* to version 2.*
In the CmsBlockWidget
module version 2.0.0, we have:
- updated
CmsBlockWidgetTwigPlugin
with the support of getting CMS blocks by keys and names; - increased the version of
spryker/cms-block-storage
incomposer.json
; - removed the
TwigCmsBlock
plugin; - introduced
CmsBlockWidgetToCmsBlockStorageClient::findBlocksByKeys()
that finds blocks by keys; - introduced
CmsBlockWidgetToCmsBlockStorageClient::findBlockKeysByOptions()
that finds block keys by provided options; - deprecated
CmsBlockWidgetToCmsBlockStorageClient::findBlocksByNames()
; - removed
CmsBlockWidgetToCmsBlockStorageClient::findBlockNamesByOptions()
; - removed
CmsBlockWidgetToCmsBlockStorageClient::generateBlockNameKey()
.
Estimated migration time: 30m-1h
To upgrade to the new version of the module, do the following:
- Upgrade the
CmsBlock
module to version 3.0.0. See Migration Guide - CmsBlock. - Upgrade the
CmsBlockStorage
module to version 2.0.0. See Migration Guide - CmsBlockStorage. - Upgrade the
CmsBlockWidget
module to version 2.0.0:
composer require spryker-shop/cms-block-widget:"^2.0.0" --update-with-dependencies
The new version of the CmsBlockWidget
module implements the spyCmsBlock
widget that gets data by CMS block keys.You can still use the widget that gets data by CMS block names, e.g. {{ spyCmsBlock(name: 'Block name') }}
. However, this will cause two separate storage requests to be created in the back end. The first gets mapped keys by CMS block names while the second uses those keys to get CMS blocks. Also, if a widget has both key
and name
parameters, the key
parameter is processed first.
Use the new widget:
- with the
key
parameter:
{{ spyCmsBlock(keys: ['blck-1']) }}
- with the
name
parameter (deprecated functionality):
{{ spyCmsBlock(name: 'Block name') }}
- with the
category
andposition
parameters:
{{ spyCmsBlock({ category: category_id, position: 'top' }) }}
- with the
product
parameter:
{{ spyCmsBlock({ product: product_id }) }}
Thank you!
For submitting the form