From 5ffccafabdf4ea320a7972980440565942b50979 Mon Sep 17 00:00:00 2001 From: Josh Darby Date: Tue, 16 Jul 2019 14:13:23 -0400 Subject: [PATCH] Allow organization to display alone if the credit doesn't exist --- js/blocks-image-customization.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/js/blocks-image-customization.js b/js/blocks-image-customization.js index d1bc2de99..87c1caddd 100644 --- a/js/blocks-image-customization.js +++ b/js/blocks-image-customization.js @@ -14,15 +14,23 @@ var largo_core_image_block_add_media_credit = createHigherOrderComponent( functi // the original instance of the media caption var attachment_caption = props.attributes.caption; - if( media.media_credit && media.media_credit._media_credit ){ + if( media.media_credit && ( media.media_credit._media_credit || media.media_credit._navis_media_credit_org ) ){ - var media_credit = media.media_credit._media_credit; - - // if the media credit organization exists, add it - if( media.media_credit._navis_media_credit_org ){ + // if both the credit and organization are present + if( media.media_credit._media_credit && media.media_credit._navis_media_credit_org ){ var media_credit = media.media_credit._media_credit+' / '+media.media_credit._navis_media_credit_org; + // if only the credit is present + } else if( media.media_credit._media_credit ){ + + var media_credit = media.media_credit._media_credit; + + // if only the org is present + } else if( media.media_credit._navis_media_credit_org ){ + + var media_credit = media.media_credit._navis_media_credit_org; + } // if the media credit url exists, wrap the media credit with it