@pronto-tools-and-more/components-renderer 8.12.0 → 8.14.0
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1,17 +1,23 @@
|
|
1
|
+
const getImageSrc = (fallbackImage) => {
|
2
|
+
if (fallbackImage) {
|
3
|
+
return `$functions.fallback($functions.id($context, 'search-result', 'issue', 'thumbnails', 'default'), '${fallbackImage}')`;
|
4
|
+
}
|
5
|
+
return `$functions.id($context, 'search-result', 'issue', 'thumbnails', 'default')`;
|
6
|
+
};
|
7
|
+
|
1
8
|
export const renderCustomElementSearchResults = (element, renderElement) => {
|
2
9
|
if (
|
3
10
|
element.type === "list" &&
|
4
11
|
element.class &&
|
5
12
|
element.class.includes("data-custom-search-results")
|
6
13
|
) {
|
7
|
-
const { render, ...rest } = element;
|
14
|
+
const { render, fallbackImage, ...rest } = element;
|
8
15
|
const node = render({
|
9
16
|
title: "$functions.id($context, 'search-result', 'issue', 'name')",
|
10
17
|
name: "$functions.id($context, 'search-result', 'issue', 'name')",
|
11
18
|
description:
|
12
19
|
"$functions.id($context, 'search-result', 'issue', 'description')",
|
13
|
-
imageSrc:
|
14
|
-
"$functions.id($context, 'search-result', 'issue', 'thumbnails', 'default')",
|
20
|
+
imageSrc: getImageSrc(fallbackImage),
|
15
21
|
language:
|
16
22
|
"$functions.id($context, 'search-result', 'issue', 'properties', 'lang')",
|
17
23
|
slug: "$functions.id($context, 'search-result', 'issue', 'properties', 'slug')",
|