Skip to content
Snippets Groups Projects
Commit 3774066f authored by Shibin Das's avatar Shibin Das
Browse files

Issue #3495399 by d34dman: Deprecate RiftPicture::responsivePictureFromElement...

Issue #3495399 by d34dman: Deprecate RiftPicture::responsivePictureFromElement and its helper methods
parent 68c611fe
No related branches found
No related tags found
No related merge requests found
......@@ -66,7 +66,7 @@ class Rift extends AbstractExtension {
* @param array $config
* Configuration for generating srcset.
* <code>
* content.field_common_image|rift_picture({
* node.field_common_image.0.entity|rift_picture({
* sizes: "120w 320w 320w 1024w 1024w",
* aspect_ratios: "1x1 16x9 1x1 1x1 1x1",
* quality: {
......
......@@ -158,24 +158,31 @@ class RiftPicture {
return $picture_sources_data;
}
/**
* Get sitewide default configurations.
*
* @return array
* The default configurations.
*/
protected function getDefaultConfig(): array {
$config = $this->configFactory->get('rift.settings')->get('config');
$config['url_generation_strategy'] = $this->getDefaultSourcePluginId();
return $config;
}
/**
* Responsive Picture twig filter.
*
* @deprecated in rift:1.3.2 and is removed from rift:2.0.0.
* This method was supposed to be used via Twig Filter. However, the
* twig filter expects a Media Entity to be provided, instead of
* field content. Thus using the twig filter "rift_picture" is not
* supported by rift media and this method would be removed.
*
* @param array|null $element
* Render array element.
* @param array $config
* Configuration for generating srcset.
* <code>
* content.field_common_image|rift_picture({
* sources: "120w 320w 320w 1024w 1024w",
* aspect_ratios: "1x1 16x9 1x1 1x1 1x1",
* quality: {
* 1x: "80 80 80 80 80",
* 2x: "40 40 40 40 40",
* },
* formats: ['webp', 'avif', 'jpeg'],
* })
* </code>.
*
* @return string[]
* Render array for responsive picture tag.
......@@ -195,18 +202,6 @@ class RiftPicture {
];
}
/**
* Get sitewide default configurations.
*
* @return array
* The default configurations.
*/
protected function getDefaultConfig(): array {
$config = $this->configFactory->get('rift.settings')->get('config');
$config['url_generation_strategy'] = $this->getDefaultSourcePluginId();
return $config;
}
/**
* Responsive Picture twig filter.
*
......@@ -215,7 +210,7 @@ class RiftPicture {
* @param array $config
* Configuration for generating srcset.
* <code>
* content.field_common_image|rift_picture({
* node.field_common_image.0.entity|rift_picture({
* sources: "120w 320w 320w 1024w 1024w",
* aspect_ratios: "1x1 16x9 1x1 1x1 1x1",
* quality: {
......@@ -300,6 +295,12 @@ class RiftPicture {
/**
* Detect Image file uri from given render element.
*
* @deprecated in rift:1.3.2 and is removed from rift:2.0.0.
* This method was supposed to be used via Twig Filter. However, the
* twig filter expects a Media Entity to be provided, instead of
* field content. Thus using the twig filter "rift_picture" is not
* supported by rift media and this method would be removed.
*
* @param array|null $element
* Render array element.
*
......@@ -321,8 +322,11 @@ class RiftPicture {
/**
* Provide bubbling up of cache tags on render elements when bypassing render.
*
* This would resolve issues with improper caching when field are not printed
* as render array.
* @deprecated in rift:1.3.2 and is removed from rift:2.0.0.
* This method was supposed to be used via Twig Filter. However, the
* twig filter expects a Media Entity to be provided, instead of
* field content. Thus using the twig filter "rift_picture" is not
* supported by rift media and this method would be removed.
*/
public function bubbleUpCacheTags(&$element) {
// @todo Find proper way to do this.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment