Skip to content

Commit

Permalink
Allow organization to display alone if the credit doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Darby committed Jul 16, 2019
1 parent 4c9f1dc commit 5ffccaf
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions js/blocks-image-customization.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5ffccaf

Please sign in to comment.