creativedotdesign / tofino

WordPress boilerplate theme on a modern stack. NPM and Composer.
Other
29 stars 6 forks source link

Error when calling responsive_image_attribute_values(), and it's not used. #342

Closed Malcolm-Remple closed 1 year ago

Malcolm-Remple commented 2 years ago

https://github.com/creativedotdesign/tofino/blob/b27d2f31f706bb82e46164667431b03a04bb36fc/inc/lib/helpers.php#L209

Notice: Trying to access array offset on value of type bool in /Users/malcolm/Websites/cypress-testing/app/public/wp-content/themes/tofino/inc/lib/helpers.php on line 209

danimalweb commented 2 years ago

Please post an example of how you are using this function.

Malcolm-Remple commented 2 years ago

If the image field is empty on the backend, I get this error with similar code. $image_values = \Tofino\Helpers\responsive_image_attribute_values();

if ($image_values['src']): ?>
  <img
    src="<?php echo $image_values['src']; ?>"
    srcset="<?php echo $image_values['srcset']; ?>"
    sizes="<?php echo $image_values['sizes']; ?>"
endif;

Screen Shot 2022-04-29 at 4 47 51 PM