NO BUG: Dynamic values not rendering on basic text element

When trying to echo a custom function, I find an issue when using the following code on a text block:

{echo:get_video_thumbnail({mb_lessons_lesson__video_id})}

The output is:

<img class="css-filter size-medium_large" src="https://img.youtube.com/vi/mb_lessons_lesson__video_id/maxresdefault.jpg" alt="">

It is returning mb_lessons_lesson__video_id instead of the dynamic value. (broken thumbnail in the video below).

However, the function returns the correct value when run using the Code element as:

<?php
	$video_id = rwmb_meta( 'lesson__video_id' );
  $video_url = get_video_thumbnail($video_id);
	$video_thumbnail = '<figure class="brxe-ixdwfo brxe-image lesson-card__thumbnail outlined tag"><img class="css-filter size-medium_large" src='.$video_url.'></figure>';
  echo $video_thumbnail;
?>

The actual function Iā€™m using is:

function get_video_thumbnail($video_id) {
    // set the default Thumbnail
    $youtube_thumbnail_url = '/wp-content/uploads/Horizontal-Big.svg';
    // get the Youtube Thumbnail
    if ($video_id) {
        $youtube_thumbnail_url = 'https://img.youtube.com/vi/'.$video_id.'/maxresdefault.jpg';
    }
    // WP Featured Image always overights the Youtube Thumbnail
    if (has_post_thumbnail()) {
        $youtube_thumbnail_url = get_the_post_thumbnail_url();
    }
    return $youtube_thumbnail_url;
}

Am I missing something? Is it something on the function, I tried to keep it as simple as possible or is this a bug on the text element in Bricks?
Thanks for your assistance.

Hi Robert,
Thanks so much for your report!

Sounds similar to this report WAIT: Problem with image dynamic data, but none of the users can provide us with access data :face_holding_back_tears:

Would you be so kind as to send temporary login credentials and a link to this thread to help@bricksbuilder.io using the email address you used during the purchase?

Best regards,
timmse

sending you an email now. Thanks for your help on this.

Hi @gdnwebmedia ,

Thank you so much for the credential after 6 months :stuck_out_tongue:
Anyway, please note that your function is going to return Image URL and the image might not be inside Media Library. Hence, your image will not work.

Please use the function in External URL field.
If you want it to work in Dynamic Data field, have to ensure the image is located inside the media library and return the media ID.

This is the result
image

Regards,
Jenn

2 Likes

Time flies!
Thank you so much for your help! I will try it. (hopefully within the next 6 months!)