Skip to content

Commit

Permalink
Merge pull request #534 from stellarwp/bugfix/KAD-3169
Browse files Browse the repository at this point in the history
bugfix/KAD-3169
  • Loading branch information
oakesjosh authored Aug 23, 2024
2 parents 7dd5f5b + 3be1c9f commit 4c2564c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
7 changes: 6 additions & 1 deletion includes/blocks/class-kadence-blocks-image-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,12 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {
if ( isset( $caption_font['textTransform'] ) && ! empty( $caption_font['textTransform'] ) ) {
$css->add_property( 'text-transform', $caption_font['textTransform'] );
}
if ( isset( $caption_font['family'] ) && ! empty( $caption_font['family'] ) ) {
if ( isset( $caption_font['google']) && ! empty($caption_font['google'] ) ) {
$google = $caption_font['google'] ? true : false;
$google = $google && ( isset( $caption_font['loadGoogle'] ) && $caption_font['loadGoogle'] || ! isset( $caption_font['loadGoogle'] ) ) ? true : false;
$variant = ! empty( $caption_font['variant'] ) ? $caption_font['variant'] : null;
$css->add_property( 'font-family', $css->render_font_family( $caption_font['family'], $google, $variant ) );
} elseif ( isset( $caption_font['family'] ) && ! empty( $caption_font['family'] ) ) {
$css->add_property( 'font-family', $caption_font['family'] );
}
if ( isset( $caption_font['style'] ) && ! empty( $caption_font['style'] ) ) {
Expand Down
13 changes: 13 additions & 0 deletions src/blocks/image/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ import {
GradientControl,
BackgroundTypeControl,
KadenceFocalPicker,
KadenceWebfontLoader,
} from '@kadence/components';

export default function Image({
Expand Down Expand Up @@ -1845,6 +1846,18 @@ export default function Image({
__unstableOnSplitAtEnd={() => insertBlocksAfter(createBlock('core/paragraph'))}
/>
)}
{captionStyles[0].google && captionStyles[0].family && (
<KadenceWebfontLoader
typography={[
{
family: captionStyles[0].family,
variant: captionStyles[0].variant ? captionStyles[0].variant : '',
},
]}
clientId={clientId}
id={'advancedImage'}
/>
)}
</>
);
}

0 comments on commit 4c2564c

Please sign in to comment.