Skip to content

Commit

Permalink
update getFieldURL function
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed May 26, 2023
1 parent fad035e commit 49e4bd7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Blocks/Quote/variations/TestimonialQuote.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import {
createSlateParagraph,
serializeText,
} from '@eeacms/volto-quote-block/helpers';
import Quote from './DefaultQuote';
import { getFieldURL } from '@eeacms/volto-quote-block/helpers';
import Quote from './DefaultQuote';

import DefaultImageSVG from '@plone/volto/components/manage/Blocks/Listing/default-image.svg';

function Divider({ ...rest }) {
Expand Down
4 changes: 2 additions & 2 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export const getFieldURL = (data) => {
let url = data;
const _isObject = data && isObject(data) && !isArray(data);
if (_isObject && data['@type'] === 'URL') {
url = data['value'] || data['url'] || data['href'] || data;
url = data['value'] ?? data['url'] ?? data['href'] ?? data;
} else if (_isObject) {
url = data['@id'] || data['url'] || data['href'] || data;
url = data['@id'] ?? data['url'] ?? data['href'] ?? data;
}
if (isArray(data)) {
url = data.map((item) => getFieldURL(item));
Expand Down

0 comments on commit 49e4bd7

Please sign in to comment.