I’m trying to create a block for a site logo that lets me specify an SVG with PNG/JPG fallback, and I’m running into some issues. As soon as I tell it that I want to set my srcset attribute, it writes the following PHP code: (PG Desktop 7.1 — issue is not limited to SVG, it happens with other formats as well)
srcset="<?php echo PG_Blocks::getImageUrl( $args, <?php echo get_template_directory_uri(); ?>/'svg_logo_src', <?php echo get_template_directory_uri(); ?>/'full' ) ?>"/>
instead of
srcset="<?php echo PG_Blocks::getImageUrl( $args, 'svg_logo_src', 'full' ) ?>"/>
Which gives me a lovely error message on the page.
Parse error : syntax error, unexpected token “<”, expecting “)”
Is there a different/better way for me to do this? (Note: I did have this working at one point by setting the image with a customizer field action, but I’m doing a block theme and want to try to do as much as I can with blocks.)
Screenshots:
Tree:
Block Attribute (Smart)
Block Attribute (Converted to regular with the same results)