$desktop_id, 'rounded' => false, 'desktopAspectRatio' => '1', 'mobileAspectRatio' => '1', ]; foreach ( [ 'mobileId' => 'int', 'desktopAlt' => 'string', 'sizes' => 'string', 'priority' => 'string' ] as $key => $type ) { $value = $attributes[ $key ] ?? null; if ( 'int' === $type && (int) $value ) { $image[ $key ] = (int) $value; } elseif ( 'string' === $type && '' !== trim( (string) $value ) && 'auto' !== (string) $value ) { $image[ $key ] = trim( (string) $value ); } } if ( ! isset( $image['desktopAlt'] ) ) { $image['decorative'] = true; } if ( isset( $image['priority'] ) && 'high' === $image['priority'] ) { $image['loading'] = 'eager'; } $inner = (string) render_block( [ 'blockName' => 'rooster/responsive-image', 'attrs' => $image, 'innerBlocks' => [], 'innerHTML' => '', 'innerContent' => [], ] ); } if ( '' === trim( $inner ) ) { $slug = trim( (string) ( $attributes['motif'] ?? '' ) ); $pattern = '' !== $slug && class_exists( 'WP_Block_Patterns_Registry' ) ? WP_Block_Patterns_Registry::get_instance()->get_registered( $slug ) : null; $html = $pattern && ! empty( $pattern['content'] ) ? trim( (string) do_blocks( (string) $pattern['content'] ) ) : ''; $inner = '' !== $html ? '' : ''; } if ( '' === $inner ) { return; } $wrapper = AIEO_Engine_Blocks::wrapper( $library, [ 'class' => 'rooster-media-frame', 'data-rooster-ui' => 'rooster-one/media' ] ); AIEO_Engine_Blocks::out( sprintf( '
%2$s
', $wrapper, $inner ) );