From what I understand about the source code for the dynamic-data field of the SVG element, the dynamic-data tag must include a valid attachment ID. However, it would be ideal if we could simply return an SVG file using read_file
or an SVG string using file_get_contents
, allowing us to create reusable dynamic-data tags for SVGs across a multisite environment. In case of a multisite, I have no control over the attachment ID assigned to the SVGs when they are being uploaded.
Source Code Bricks SVG-Element:
// Get SVG from dynamic data
if ( $source === 'dynamicData' && ! empty( $settings['dynamicData'] ) ) {
$svg_data = $this->render_dynamic_data_tag( $settings['dynamicData'], 'image' );
$file_id = ! empty( $svg_data[0] ) && is_numeric( $svg_data[0] ) ? $svg_data[0] : false;
if ( $file_id ) {
$svg_path = get_attached_file( $file_id );
$svg = $svg_path ? Helpers::file_get_contents( $svg_path ) : false;
}
}